You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[subinterpreters] Unicode interned strings must not be shared between interpreters #90441
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee=Noneclosed_at=Nonecreated_at=<Date2022-01-06.15:21:22.175>labels= ['expert-subinterpreters', '3.11']
title='[subinterpreters] Unicode interned strings must not be shared between interpreters'updated_at=<Date2022-01-10.10:50:20.435>user='https://github.com/vstinner'
My commit ea25180 made Unicode interned strings per interpreter to avoid accessing the same Python object from two different interpreters, to avoid race conditions on its reference count.
Problem: the change introduced the bpo-46006 regression in _PyUnicode_EqualToASCIIId() and type update_slot() functions which make the assumption that if two strings are interned and their pointers are not equal: these strings are not equal.
3.10 branch: commit 72c260c (with changes to keep the ABI backward compatibility)
These interned strings are preventing again to run multiple interpreters in parallel, two subinterpreters must not access the same Python object: see bpo-40533.
I suggest to write a PEP to explain the rationale, and reapply my commit ea25180 with PR 30123.
Activity
vstinner commentedon Jan 6, 2022
My commit ea25180 made Unicode interned strings per interpreter to avoid accessing the same Python object from two different interpreters, to avoid race conditions on its reference count.
Problem: the change introduced the bpo-46006 regression in _PyUnicode_EqualToASCIIId() and type update_slot() functions which make the assumption that if two strings are interned and their pointers are not equal: these strings are not equal.
I proposed PR 30123 to fix these two functions, but then questions have been asked about the overall goal, running multiple Python interpreters in parallel in the same process (bpo-40512):
https://bugs.python.org/issue46006#msg408002
bpo-46006 was blocking the Python 3.11.0a4 release, Python 3.10 was affected and there were more and more affected projects:
So I decided to just revert the change on interned strings:
These interned strings are preventing again to run multiple interpreters in parallel, two subinterpreters must not access the same Python object: see bpo-40533.
I suggest to write a PEP to explain the rationale, and reapply my commit ea25180 with PR 30123.
encukou commentedon Jan 10, 2022
Another proposed alternative is to make these immortal, and share them.
There were some discussions about this, but no PEP to capture the pros/cons of the alternatives and the decision.
vstinner commentedon Nov 3, 2022
Since most core developers seem to prefer https://peps.python.org/pep-0683/ (even if it's still a draft), I close this issue.