[Python-Dev] List mutation in list_repr? (original) (raw)
Serhiy Storchaka storchaka at gmail.com
Wed Dec 7 13🔞55 EST 2016
- Previous message (by thread): [Python-Dev] List mutation in list_repr?
- Next message (by thread): [Python-Dev] [RELEASE] Python 3.6.0rc1 is now available
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 07.12.16 12:19, Patrick Westerhoff wrote:
On Tue, Dec 6, 2016 at 5:32 PM, Random832 <random832 at fastmail.com> wrote:
It shouldn't, but it can't be enforced. It's one of those things where if Python assumes all user code is sane (in this case, overridden repr not messing with the list) it can bite in a way that could cause the interpreter to crash. I guess you are right. That makes sense. I didn’t think about the possibility that although the repr implementation is happening in native code where the user objects have no access to, the list object could still be referenced outside of the repr call.
There is another reason. Executing Python code can release GIL. The list object can be modified in other thread.
- Previous message (by thread): [Python-Dev] List mutation in list_repr?
- Next message (by thread): [Python-Dev] [RELEASE] Python 3.6.0rc1 is now available
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]