[New-bugs-announce] [issue3319] pystone.main(10) causes ZeroDivisionError

Michael Patrick O'Keefe report at bugs.python.org
Tue Jul 8 10:44:06 CEST 2008


New submission from Michael Patrick O'Keefe <michael.p.okeefe at gmail.com>:

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 "<stdin>", line 1, in <module>
  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

----------
components: Library (Lib), Tests
files: pystone_patch.txt
messages: 69418
nosy: mokeefe
severity: normal
status: open
title: pystone.main(10) causes ZeroDivisionError
type: behavior
versions: Python 2.5, Python 3.0
Added file: http://bugs.python.org/file10853/pystone_patch.txt

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue3319>
_______________________________________


More information about the New-bugs-announce mailing list