[pypy-commit] pypy default: Avoid blowing up with results that are ~0 but <0 due to floating point imprecision

stefanor pypy.commits at gmail.com
Wed Aug 31 19:49:32 EDT 2016


Author: Stefano Rivera <stefano at rivera.za.net>
Branch: 
Changeset: r86804:447f36f19521
Date: 2016-08-31 16:48 -0700
http://bitbucket.org/pypy/pypy/changeset/447f36f19521/

Log:	Avoid blowing up with results that are ~0 but <0 due to floating
	point imprecision

diff --git a/rpython/translator/backendopt/inline.py b/rpython/translator/backendopt/inline.py
--- a/rpython/translator/backendopt/inline.py
+++ b/rpython/translator/backendopt/inline.py
@@ -532,8 +532,7 @@
         return sys.maxint
     else:
         res = Solution[blockmap[graph.startblock]]
-        assert res >= 0
-        return res
+        return max(res, 0.0)
 
 def static_instruction_count(graph):
     count = 0


More information about the pypy-commit mailing list