[pypy-commit] pypy default: (cfbolz, arigo)

arigo noreply at buildbot.pypy.org
Tue Dec 9 18:00:08 CET 2014


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r74870:d5298ea685c7
Date: 2014-12-09 16:59 +0000
http://bitbucket.org/pypy/pypy/changeset/d5298ea685c7/

Log:	(cfbolz, arigo)

	Clarify what error we get from calling getattr() with 3 args in
	RPython

diff --git a/rpython/flowspace/operation.py b/rpython/flowspace/operation.py
--- a/rpython/flowspace/operation.py
+++ b/rpython/flowspace/operation.py
@@ -528,6 +528,10 @@
     pyfunc = staticmethod(getattr)
 
     def constfold(self):
+        from rpython.flowspace.flowcontext import FlowingError
+        if len(self.args) == 3:
+            raise FlowingError(
+                "getattr() with three arguments not supported: %s" % (self,))
         w_obj, w_name = self.args
         # handling special things like sys
         if (w_obj in NOT_REALLY_CONST and
@@ -538,7 +542,6 @@
             try:
                 result = getattr(obj, name)
             except Exception as e:
-                from rpython.flowspace.flowcontext import FlowingError
                 etype = e.__class__
                 msg = "getattr(%s, %s) always raises %s: %s" % (
                     obj, name, etype, e)


More information about the pypy-commit mailing list