Author gvanrossum
Recipients gvanrossum, vstinner
Date 2021-04-21.18:52:19
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1619031139.87.0.55032170532.issue43908@roundup.psfhosted.org>
In-reply-to
Content
Hi Victor,

Sorry for making this a deferred blocker. I recall that we had a brief discussion somewhere about an accidental change to the array.array type -- this is now a heap type (Py_TPFLAGS_HEAPTYPE is set), and as a consequence it is no longer immutable.

In 3.9 this is an error:

>>> import array        
>>> array.array.foo = 1
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: can't set attributes of built-in/extension type 'array.array'
>>>

But in 3.10a7 it passes:

>>> array.array.foo = 1
>>> array.array.foo    
1
>>>

I would like this type (and other types that have been or will be converted to heap types) to remain immutable. How can we do that? I think we may need a new flag bit meaning "built-in type, immutable". This bit should not be inherited of course.

What do you think? (Feel free to close if this is a duplicate -- I couldn't find where we discussed this previously, sorry.)
History
Date User Action Args
2021-04-21 18:52:19gvanrossumsetrecipients: + gvanrossum, vstinner
2021-04-21 18:52:19gvanrossumsetmessageid: <1619031139.87.0.55032170532.issue43908@roundup.psfhosted.org>
2021-04-21 18:52:19gvanrossumlinkissue43908 messages
2021-04-21 18:52:19gvanrossumcreate