[pypy-svn] pypy default: Fix: it seems that test_rlist.py shows a case in which can_only_throw

arigo commits-noreply at bitbucket.org
Tue Feb 15 11:09:55 CET 2011


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r41946:ec76a8c2303d
Date: 2011-02-15 11:09 +0100
http://bitbucket.org/pypy/pypy/changeset/ec76a8c2303d/

Log:	Fix: it seems that test_rlist.py shows a case in which
	can_only_throw here can again be a callable.

diff --git a/pypy/annotation/unaryop.py b/pypy/annotation/unaryop.py
--- a/pypy/annotation/unaryop.py
+++ b/pypy/annotation/unaryop.py
@@ -646,7 +646,12 @@
     def _can_only_throw(bltn, *args):
         analyser_func = getattr(bltn.analyser, 'im_func', None)
         can_only_throw = getattr(analyser_func, 'can_only_throw', None)
-        return can_only_throw   # or None to mean "anything"
+        if can_only_throw is None or isinstance(can_only_throw, list):
+            return can_only_throw
+        if bltn.s_self is not None:
+            return can_only_throw(bltn.s_self, *args)
+        else:
+            return can_only_throw(*args)
 
     def simple_call(bltn, *args):
         if bltn.s_self is not None:


More information about the Pypy-commit mailing list