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

stefanor pypy.commits at gmail.com
Thu Sep 1 23:36:42 EDT 2016


Author: Stefano Rivera <stefano at rivera.za.net>
Branch: release-5.x
Changeset: r86831:5169ca3e696d
Date: 2016-09-01 20:35 -0700
http://bitbucket.org/pypy/pypy/changeset/5169ca3e696d/

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