[pypy-commit] pypy default: Revert changes 0d92840e04ff and 347b4430addd, breaks random user programs like 'nose'.
arigo
pypy.commits at gmail.com
Sat Feb 4 03:34:01 EST 2017
Author: Armin Rigo <arigo at tunes.org>
Branch:
Changeset: r89916:3847916c649c
Date: 2017-02-04 09:33 +0100
http://bitbucket.org/pypy/pypy/changeset/3847916c649c/
Log: Revert changes 0d92840e04ff and 347b4430addd, breaks random user
programs like 'nose'.
diff --git a/pypy/interpreter/function.py b/pypy/interpreter/function.py
--- a/pypy/interpreter/function.py
+++ b/pypy/interpreter/function.py
@@ -198,21 +198,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")
@@ -671,7 +660,7 @@
Function.__init__(self, func.space, func.code, func.w_func_globals,
func.defs_w, func.closure, 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
def descr_builtinfunction__new__(space, w_subtype):
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
@@ -98,14 +98,6 @@
raises(TypeError, "dir.func_code = f.func_code")
raises(TypeError, "list.append.im_func.func_code = f.func_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:
More information about the pypy-commit
mailing list