[pypy-commit] pypy py3.5: hg merge default

arigo pypy.commits at gmail.com
Sat Feb 4 03:34:37 EST 2017


Author: Armin Rigo <arigo at tunes.org>
Branch: py3.5
Changeset: r89917:9ff55469638c
Date: 2017-02-04 09:33 +0100
http://bitbucket.org/pypy/pypy/changeset/9ff55469638c/

Log:	hg merge default

diff --git a/pypy/interpreter/function.py b/pypy/interpreter/function.py
--- a/pypy/interpreter/function.py
+++ b/pypy/interpreter/function.py
@@ -207,21 +207,10 @@
 
     def getdict(self, space):
         if self.w_func_dict is None:
-            if not self.can_change_code:
-                raise oefmt(space.w_AttributeError,
-                            "cannot set extra attributes on built-in functions")
             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,
-                        "cannot set __dict__ on built-in functions")
         if not space.isinstance_w(w_dict, space.w_dict):
             raise oefmt(space.w_TypeError,
                         "setting function's dictionary to a non-dict")
@@ -706,7 +695,7 @@
                           func.defs_w, None, func.closure,
                           None, func.name)
         self.w_doc = func.w_doc
-        #self.w_func_dict = func.w_func_dict---nowadays, always None
+        self.w_func_dict = func.w_func_dict
         self.w_module = func.w_module
         self.w_kw_defs = func.w_kw_defs
 
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
@@ -163,14 +163,6 @@
         raises(TypeError, "dir.__code__ = f.__code__")
         raises(TypeError, "list.append.__code__ = f.__code__")
 
-    def test_write_extra_attributes_builtin_forbidden(self):
-        raises(AttributeError, "dir.abcd = 5")
-        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")
         exec('''if 1:
diff --git a/pypy/module/micronumpy/compile.py b/pypy/module/micronumpy/compile.py
--- a/pypy/module/micronumpy/compile.py
+++ b/pypy/module/micronumpy/compile.py
@@ -65,6 +65,8 @@
     w_KeyError = W_TypeObject("KeyError")
     w_SystemExit = W_TypeObject("SystemExit")
     w_KeyboardInterrupt = W_TypeObject("KeyboardInterrupt")
+    w_RuntimeError = W_TypeObject("RuntimeError")
+    w_RecursionError = W_TypeObject("RecursionError")   # py3.5
     w_VisibleDeprecationWarning = W_TypeObject("VisibleDeprecationWarning")
     w_None = W_Root()
 


More information about the pypy-commit mailing list