[pypy-svn] commit/pypy: cfbolz: not that it matters terribly, but fix immutable_builtintypes in the presence of

Bitbucket commits-noreply at bitbucket.org
Fri Dec 17 11:33:20 CET 2010


1 new changeset in pypy:

http://bitbucket.org/pypy/pypy/changeset/e6991321d78b/
changeset:   r40064:e6991321d78b
user:        cfbolz
date:        2010-12-17 11:32:54
summary:     not that it matters terribly, but fix immutable_builtintypes in the presence of
builtinshortcut, by turning it instead into mutable_builtintypes and putting
the right dependency.
affected #:  5 files (130 bytes)

--- a/pypy/config/pypyoption.py	Fri Dec 17 09:45:32 2010 +0100
+++ b/pypy/config/pypyoption.py	Fri Dec 17 11:32:54 2010 +0100
@@ -301,7 +301,7 @@
                    default=False),
         BoolOption("newshortcut",
                    "cache and shortcut calling __new__ from builtin types",
-                   default=False),        
+                   default=False),
 
         BoolOption("logspaceoptypes",
                    "a instrumentation option: before exit, print the types seen by "
@@ -310,8 +310,9 @@
         ChoiceOption("multimethods", "the multimethod implementation to use",
                      ["doubledispatch", "mrd"],
                      default="mrd"),
-        BoolOption("immutable_builtintypes",
-                   "Forbid the changing of builtin types", default=True),
+        BoolOption("mutable_builtintypes",
+                   "Allow the changing of builtin types", default=False,
+                   requires=[("objspace.std.builtinshortcut", True)]),
      ]),
 ])
 


--- a/pypy/doc/config/objspace.std.immutable_builtintypes.txt	Fri Dec 17 09:45:32 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-Disallow modification of builtin types.  Enabled by default.


--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/pypy/doc/config/objspace.std.mutable_builtintypes.txt	Fri Dec 17 11:32:54 2010 +0100
@@ -0,0 +1,1 @@
+Allow modification of builtin types.  Disabled by default.


--- a/pypy/objspace/std/test/test_typeobject.py	Fri Dec 17 09:45:32 2010 +0100
+++ b/pypy/objspace/std/test/test_typeobject.py	Fri Dec 17 11:32:54 2010 +0100
@@ -943,7 +943,7 @@
 class AppTestMutableBuiltintypes:
 
     def setup_class(cls):
-        cls.space = gettestobjspace(**{"objspace.std.immutable_builtintypes": False})
+        cls.space = gettestobjspace(**{"objspace.std.mutable_builtintypes": True})
 
     def test_del_type_mro(self):
         del type.mro


--- a/pypy/objspace/std/typeobject.py	Fri Dec 17 09:45:32 2010 +0100
+++ b/pypy/objspace/std/typeobject.py	Fri Dec 17 11:32:54 2010 +0100
@@ -134,7 +134,7 @@
 
     def mutated(w_self):
         space = w_self.space
-        assert w_self.is_heaptype() or not space.config.objspace.std.immutable_builtintypes
+        assert w_self.is_heaptype() or space.config.objspace.std.mutable_builtintypes
         if (not space.config.objspace.std.withtypeversion and
             not space.config.objspace.std.getattributeshortcut and
             not space.config.objspace.std.newshortcut):
@@ -157,8 +157,8 @@
             w_subclass.mutated()
 
     def version_tag(w_self):
-        if (not we_are_jitted() or w_self.is_heaptype() or not
-            w_self.space.config.objspace.std.immutable_builtintypes):
+        if (not we_are_jitted() or w_self.is_heaptype() or
+            w_self.space.config.objspace.std.mutable_builtintypes):
             return w_self._version_tag
         # heap objects cannot get their version_tag changed
         return w_self._pure_version_tag()
@@ -784,7 +784,7 @@
             space.set(w_descr, w_type, w_value)
             return
     
-    if (space.config.objspace.std.immutable_builtintypes
+    if (not space.config.objspace.std.mutable_builtintypes
             and not w_type.is_heaptype()):
         msg = "can't set attributes on type object '%s'"
         raise operationerrfmt(space.w_TypeError, msg, w_type.name)
@@ -803,7 +803,7 @@
         if space.is_data_descr(w_descr):
             space.delete(w_descr, w_type)
             return
-    if (space.config.objspace.std.immutable_builtintypes
+    if (not space.config.objspace.std.mutable_builtintypes
             and not w_type.is_heaptype()):
         msg = "can't delete attributes on type object '%s'"
         raise operationerrfmt(space.w_TypeError, msg, w_type.name)

Repository URL: https://bitbucket.org/pypy/pypy/

--

This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.



More information about the Pypy-commit mailing list