A possible bug spotted while reviewing the code
Issue #32
closed
I was looking at the Alea
code while trying to work out how to solve a particular issue I am working on, and I noticed a suspicious piece of code. I haven't created any sort of test for it (mainly because I'm still using 2.1.2 for my actual problem) but I thought it might be worth raising.
In alea.py
line 225 (function times
):
(n2,r) = divmod(n,2)
alea2 = self.times(n2)
Should that recursive call not be self.times(n2, op)
?
Comments (7)
-
repo owner -
repo owner - changed status to open
-
repo owner -
assigned issue to
-
assigned issue to
-
repo owner Correct alea.times method (refs
#32)→ <<cset 3b810f183f38>>
-
repo owner - changed status to resolved
Fixed in 2.2.0-beta.7
-
repo owner - changed status to closed
-
repo owner Correct alea.times method (refs
#32)→ <<cset 8c4df4ec46ef>>
- Log in to comment
Yes Paul, you're completely right!
I see that this bug was introduced in Lea 2.2.0-beta.4, while correcting issue
#28. As you noticed,times
method is wrong indeed if the operator is not the addition and n > 3.Congratulations for your attentiveness and thank you for reporting! I correct this today and distribute Lea 2.2.0-beta.7 on PyPI. Lea definitely needs a formal test suite (see #6) ; it's not done yet by lack of time.