]> granicus.if.org Git - python/commitdiff
#3319: don't raise ZeroDivisionError if number of rounds is so
authorGeorg Brandl <georg@python.org>
Sat, 19 Jul 2008 13:00:22 +0000 (13:00 +0000)
committerGeorg Brandl <georg@python.org>
Sat, 19 Jul 2008 13:00:22 +0000 (13:00 +0000)
low that benchtime is zero.

Lib/test/pystone.py

index 0a25981eb68cbd6d8d3be1cce126175f835234c4..c9892ff075893fb049b201c04445f6183ad48f72 100755 (executable)
@@ -128,7 +128,11 @@ def Proc0(loops=LOOPS):
         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()