Deal with divide by zero in the python stats stuff.
util/stats/info.py: If an operation results in a divide by zero, just return None --HG-- extra : convert_revision : 19cb4319734a3a9cf02bb1966fed42eb0c8a8ade
This commit is contained in:
parent
67c276ed2e
commit
a102318412
1 changed files with 8 additions and 2 deletions
|
@ -254,7 +254,10 @@ class BinaryProxy(ValueProxy):
|
||||||
val1 = value(self.arg1, run)
|
val1 = value(self.arg1, run)
|
||||||
if val0 is None or val1 is None:
|
if val0 is None or val1 is None:
|
||||||
return None
|
return None
|
||||||
return self.op(val0, val1)
|
try:
|
||||||
|
return self.op(val0, val1)
|
||||||
|
except ZeroDivisionError:
|
||||||
|
return None
|
||||||
|
|
||||||
def __vectorvalue__(self, run, index):
|
def __vectorvalue__(self, run, index):
|
||||||
if scalar(self.arg0):
|
if scalar(self.arg0):
|
||||||
|
@ -269,7 +272,10 @@ class BinaryProxy(ValueProxy):
|
||||||
if val0 is None or val1 is None:
|
if val0 is None or val1 is None:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
return self.op(val0, val1)
|
try:
|
||||||
|
return self.op(val0, val1)
|
||||||
|
except ZeroDivisionError:
|
||||||
|
return None
|
||||||
|
|
||||||
def __vectorlen__(self):
|
def __vectorlen__(self):
|
||||||
if vector(self.arg0) and scalar(self.arg1):
|
if vector(self.arg0) and scalar(self.arg1):
|
||||||
|
|
Loading…
Reference in a new issue