[pypy-commit] pypy exc-later: Change default SomeBuiltin behaviour to raising anything

rlamy noreply at buildbot.pypy.org
Tue Nov 17 12:09:21 EST 2015


Author: Ronan Lamy <ronan.lamy at gmail.com>
Branch: exc-later
Changeset: r80731:e143cbe401d1
Date: 2015-11-17 17:09 +0000
http://bitbucket.org/pypy/pypy/changeset/e143cbe401d1/

Log:	Change default SomeBuiltin behaviour to raising anything

diff --git a/rpython/annotator/model.py b/rpython/annotator/model.py
--- a/rpython/annotator/model.py
+++ b/rpython/annotator/model.py
@@ -565,8 +565,8 @@
 
     @property
     def can_only_throw(self):
-        # Unless otherwise specified, builtins don't raise exceptions
-        return getattr(self.analyser, 'can_only_throw', [])
+        # Unless otherwise specified, builtins can raise any exception
+        return getattr(self.analyser, 'can_only_throw', None)
 
 
 class SomeBuiltinMethod(SomeBuiltin):
diff --git a/rpython/rtyper/lltypesystem/lltype.py b/rpython/rtyper/lltypesystem/lltype.py
--- a/rpython/rtyper/lltypesystem/lltype.py
+++ b/rpython/rtyper/lltypesystem/lltype.py
@@ -2192,6 +2192,7 @@
         # presence of s_extraargs
         r = SomePtr(Ptr(s_T.const))
     return r
+ann_malloc.can_only_throw = [MemoryError]
 
 
 def free(p, flavor, track_allocation=True):


More information about the pypy-commit mailing list