[Python-checkins] r65135 - python/trunk/Lib/test/pystone.py

georg.brandl python-checkins at python.org
Sat Jul 19 15:00:22 CEST 2008


Author: georg.brandl
Date: Sat Jul 19 15:00:22 2008
New Revision: 65135

Log:
#3319: don't raise ZeroDivisionError if number of rounds is so
low that benchtime is zero.


Modified:
   python/trunk/Lib/test/pystone.py

Modified: python/trunk/Lib/test/pystone.py
==============================================================================
--- python/trunk/Lib/test/pystone.py	(original)
+++ python/trunk/Lib/test/pystone.py	Sat Jul 19 15:00:22 2008
@@ -128,7 +128,11 @@
         IntLoc1 = Proc2(IntLoc1)
 
     benchtime = clock() - starttime - nulltime
-    return benchtime, (loops / benchtime)
+    if benchtime == 0.0:
+        loopsPerBenchtime = 0.0
+    else:
+        loopsPerBenchtime = (loops / benchtime)
+    return benchtime, loopsPerBenchtime
 
 def Proc1(PtrParIn):
     PtrParIn.PtrComp = NextRecord = PtrGlb.copy()


More information about the Python-checkins mailing list