Commits

Alex Gaynor committed 2db51ef

Removed mutable_builtintypes flag

  • Participants
  • Parent commits 73f1193

Comments (0)

Files changed (4)

File pypy/config/pypyoption.py

         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,

File pypy/objspace/std/dictproxyobject.py

     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()

File pypy/objspace/std/test/test_typeobject.py

         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}
 

File pypy/objspace/std/typeobject.py

         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
             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()
         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:
     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: