[pypy-commit] pypy default: Hrmph, hack more, otherwise some regular use cases raise AttributeError

arigo pypy.commits at gmail.com
Wed Feb 1 10:10:18 EST 2017


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r89888:347b4430addd
Date: 2017-02-01 16:09 +0100
http://bitbucket.org/pypy/pypy/changeset/347b4430addd/

Log:	Hrmph, hack more, otherwise some regular use cases raise
	AttributeError

diff --git a/pypy/interpreter/function.py b/pypy/interpreter/function.py
--- a/pypy/interpreter/function.py
+++ b/pypy/interpreter/function.py
@@ -204,6 +204,11 @@
             self.w_func_dict = space.newdict(instance=True)
         return self.w_func_dict
 
+    def getdictvalue(self, space, attr):
+        if not self.can_change_code:
+            return None
+        return W_Root.getdictvalue(self, space, attr)
+
     def setdict(self, space, w_dict):
         if not self.can_change_code:
             raise oefmt(space.w_AttributeError,
diff --git a/pypy/interpreter/test/test_function.py b/pypy/interpreter/test/test_function.py
--- a/pypy/interpreter/test/test_function.py
+++ b/pypy/interpreter/test/test_function.py
@@ -103,6 +103,8 @@
         raises(AttributeError, "list.append.im_func.efgh = 6")
         raises(AttributeError, "dir.__dict__")
         raises(AttributeError, "dir.__dict__ = {}")
+        c = all.__call__   # this should work
+        assert c([4, 5, 6]) is True
 
     def test_set_module_to_name_eagerly(self):
         skip("fails on PyPy but works on CPython.  Unsure we want to care")


More information about the pypy-commit mailing list