Author: Alex Gaynor <[email protected]>
Branch: 
Changeset: r50080:e5ef85031c32
Date: 2011-12-02 18:17 -0500
http://bitbucket.org/pypy/pypy/changeset/e5ef85031c32/

Log:    Mark several fields in numpy as being immutable, and the name of a
        type object as quassiimmut

diff --git a/pypy/module/micronumpy/interp_dtype.py 
b/pypy/module/micronumpy/interp_dtype.py
--- a/pypy/module/micronumpy/interp_dtype.py
+++ b/pypy/module/micronumpy/interp_dtype.py
@@ -18,6 +18,8 @@
 VOID_STORAGE = lltype.Array(lltype.Char, hints={'nolength': True, 
'render_as_void': True})
 
 class W_Dtype(Wrappable):
+    _immuable_fields_ = ["itemtype", "num", "kind"]
+
     def __init__(self, itemtype, num, kind, name, char, w_box_type, 
alternate_constructors=[]):
         self.signature = signature.BaseSignature()
         self.itemtype = itemtype
diff --git a/pypy/module/micronumpy/interp_ufuncs.py 
b/pypy/module/micronumpy/interp_ufuncs.py
--- a/pypy/module/micronumpy/interp_ufuncs.py
+++ b/pypy/module/micronumpy/interp_ufuncs.py
@@ -15,6 +15,7 @@
 
 class W_Ufunc(Wrappable):
     _attrs_ = ["name", "promote_to_float", "promote_bools", "identity"]
+    _immutable_fields_ = ["promote_to_float", "promote_bools"]
 
     def __init__(self, name, promote_to_float, promote_bools, identity):
         self.name = name
@@ -123,6 +124,7 @@
 
 
 class W_Ufunc2(W_Ufunc):
+    _immutable_fields_ = ["comparison_func", "func"]
     argcount = 2
 
     def __init__(self, func, name, promote_to_float=False, promote_bools=False,
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
@@ -102,6 +102,7 @@
                           'instancetypedef',
                           'terminator',
                           '_version_tag?',
+                          'name?',
                           ]
 
     # for config.objspace.std.getattributeshortcut
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to