Author: Alex Gaynor <[email protected]>
Branch:
Changeset: r59165:2db51efab045
Date: 2012-12-01 10:04 -0800
http://bitbucket.org/pypy/pypy/changeset/2db51efab045/
Log: Removed mutable_builtintypes flag
diff --git a/pypy/config/pypyoption.py b/pypy/config/pypyoption.py
--- a/pypy/config/pypyoption.py
+++ b/pypy/config/pypyoption.py
@@ -325,9 +325,6 @@
ChoiceOption("multimethods", "the multimethod implementation to use",
["doubledispatch", "mrd"],
default="mrd"),
- BoolOption("mutable_builtintypes",
- "Allow the changing of builtin types", default=False,
- requires=[("objspace.std.builtinshortcut", True)]),
BoolOption("withidentitydict",
"track types that override __hash__, __eq__ or __cmp__ and
use a special dict strategy for those which do not",
default=False,
diff --git a/pypy/objspace/std/dictproxyobject.py
b/pypy/objspace/std/dictproxyobject.py
--- a/pypy/objspace/std/dictproxyobject.py
+++ b/pypy/objspace/std/dictproxyobject.py
@@ -96,8 +96,7 @@
def clear(self, w_dict):
space = self.space
w_type = self.unerase(w_dict.dstorage)
- if (not space.config.objspace.std.mutable_builtintypes
- and not w_type.is_heaptype()):
+ if not w_type.is_heaptype():
msg = "can't clear dictionary of type '%s'"
raise operationerrfmt(space.w_TypeError, msg, w_type.name)
w_type.dict_w.clear()
diff --git a/pypy/objspace/std/test/test_typeobject.py
b/pypy/objspace/std/test/test_typeobject.py
--- a/pypy/objspace/std/test/test_typeobject.py
+++ b/pypy/objspace/std/test/test_typeobject.py
@@ -1075,38 +1075,6 @@
assert t.__module__
-class AppTestMutableBuiltintypes:
- spaceconfig = {"objspace.std.mutable_builtintypes": True}
-
- def test_del_type_mro(self):
- del type.mro
- # Make sure the default mro function is used.
- class X(object):
- pass
-
- def test_mutate_builtintype(self):
- list.a = 1
- def doublelen(self):
- return len(self) * 2
- list.doublelen = doublelen
- l = []
- assert l.a == 1
- l.append(100)
- assert l.doublelen() == 2
- del list.doublelen
- del list.a
- raises(AttributeError, "l.a")
-
- def test_doc(self):
- class C(object):
- pass
-
- assert C.__dict__['__dict__'].__doc__.startswith("dictionary for")
- assert C.__dict__['__weakref__'].__doc__.startswith("list of weak")
- assert property.__doc__.startswith("property(fget=None,")
- assert type.__doc__.startswith("type(object)")
- assert "run-time error" in RuntimeError.__doc__
-
class AppTestGetattributeShortcut:
spaceconfig = {"objspace.std.getattributeshortcut": True}
diff --git a/pypy/objspace/std/typeobject.py b/pypy/objspace/std/typeobject.py
--- a/pypy/objspace/std/typeobject.py
+++ b/pypy/objspace/std/typeobject.py
@@ -162,7 +162,7 @@
generic mutation.
"""
space = w_self.space
- assert w_self.is_heaptype() or
space.config.objspace.std.mutable_builtintypes
+ assert w_self.is_heaptype()
if (not space.config.objspace.std.withtypeversion and
not space.config.objspace.std.getattributeshortcut and
not space.config.objspace.std.withidentitydict and
@@ -191,8 +191,7 @@
w_subclass.mutated(key)
def version_tag(w_self):
- if (not we_are_jitted() or w_self.is_heaptype() or
- w_self.space.config.objspace.std.mutable_builtintypes):
+ if not we_are_jitted() or w_self.is_heaptype():
return w_self._version_tag
# prebuilt objects cannot get their version_tag changed
return w_self._pure_version_tag()
@@ -293,8 +292,7 @@
return w_self._getdictvalue_no_unwrapping(space, attr)
def setdictvalue(w_self, space, name, w_value):
- if (not space.config.objspace.std.mutable_builtintypes
- and not w_self.is_heaptype()):
+ if not w_self.is_heaptype():
msg = "can't set attributes on type object '%s'"
raise operationerrfmt(space.w_TypeError, msg, w_self.name)
if name == "__del__" and name not in w_self.dict_w:
@@ -317,8 +315,7 @@
def deldictvalue(w_self, space, key):
if w_self.lazyloaders:
w_self._cleanup_() # force un-lazification
- if (not space.config.objspace.std.mutable_builtintypes
- and not w_self.is_heaptype()):
+ if not w_self.is_heaptype():
msg = "can't delete attributes on type object '%s'"
raise operationerrfmt(space.w_TypeError, msg, w_self.name)
try:
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit