Issue 3319: pystone.main(10) causes ZeroDivisionError (original) (raw)

The following call results in a ZeroDivisionError in python 2.5.2 and python 3.0 alpha 3 (I presume this is also an issue for Python 2.6 but I can't explicitly confirm):

from test import pystone pystone.main(10) Traceback (most recent call last): File "", line 1, in File "/opt/local/Library/Frameworks/Python.framework/Versions/3.0/lib/python3.0/test/pystone.py", line 61, in main benchtime, stones = pystones(loops) File "/opt/local/Library/Frameworks/Python.framework/Versions/3.0/lib/python3.0/test/pystone.py", line 68, in pystones return Proc0(loops) File "/opt/local/Library/Frameworks/Python.framework/Versions/3.0/lib/python3.0/test/pystone.py", line 131, in Proc0 return benchtime, (loops / benchtime) ZeroDivisionError: float division

Note the patch I submitted checks if the benchtime is equal to 0.0 (which apparently happens on my Mac OS 10.5 PPC). If this is the case I arbitrarily set the benchtime to 1e-6. I'm not sure what the units of the benchtime variable is (seconds?). Anyhow, this fixes the issue but can someone review to confirm this is the correct behavior?

Thanks!

-Michael