[pypy-commit] pypy default: This attribute 'fields_list' is a quasi-immutable field pointing

arigo noreply at buildbot.pypy.org
Sun Aug 31 15:54:19 CEST 2014


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r73229:4dd401ace491
Date: 2014-08-31 15:53 +0200
http://bitbucket.org/pypy/pypy/changeset/4dd401ace491/

Log:	This attribute 'fields_list' is a quasi-immutable field pointing to
	a really immutable list. Interestingly enough, we have support for
	that.

diff --git a/pypy/module/_cffi_backend/ctypestruct.py b/pypy/module/_cffi_backend/ctypestruct.py
--- a/pypy/module/_cffi_backend/ctypestruct.py
+++ b/pypy/module/_cffi_backend/ctypestruct.py
@@ -17,7 +17,7 @@
 
 
 class W_CTypeStructOrUnion(W_CType):
-    _immutable_fields_ = ['alignment?', 'fields_list?', 'fields_dict?',
+    _immutable_fields_ = ['alignment?', 'fields_list?[*]', 'fields_dict?',
                           'custom_field_pos?', 'with_var_array?']
     # fields added by complete_struct_or_union():
     alignment = -1
diff --git a/pypy/module/_cffi_backend/newtype.py b/pypy/module/_cffi_backend/newtype.py
--- a/pypy/module/_cffi_backend/newtype.py
+++ b/pypy/module/_cffi_backend/newtype.py
@@ -389,7 +389,7 @@
 
     w_ctype.size = totalsize
     w_ctype.alignment = totalalignment
-    w_ctype.fields_list = fields_list
+    w_ctype.fields_list = fields_list[:]
     w_ctype.fields_dict = fields_dict
     w_ctype.custom_field_pos = custom_field_pos
     w_ctype.with_var_array = with_var_array


More information about the pypy-commit mailing list