[issue46283] [subinterpreters] Unicode interned strings must not be shared between interpreters

2022-01-10 Thread Petr Viktorin


Petr Viktorin  added the comment:

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.

--
nosy: +petr.viktorin

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46283] [subinterpreters] Unicode interned strings must not be shared between interpreters

2022-01-06 Thread STINNER Victor


New submission from STINNER Victor :

My commit ea251806b8d11b30d2182af1e589caf88acf 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:

* jep: https://github.com/ninia/jep/issues/358
* mod_wsgi: https://github.com/GrahamDumpleton/mod_wsgi/issues/729
* weechat-matrix: https://github.com/poljar/weechat-matrix/issues/293
* Fedora issue about mod_wsgi and weechat-matrix: 
https://bugzilla.redhat.com/show_bug.cgi?id=2030621

So I decided to just revert the change on interned strings:

* main branch: commit 35d6540c904ef07b8602ff014e520603f84b5886
* 3.10 branch: commit 72c260cf0c71eb01eb13100b751e9d5007d00b70 (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 
ea251806b8d11b30d2182af1e589caf88acf with PR 30123.

--
components: Subinterpreters
messages: 409860
nosy: vstinner
priority: normal
severity: normal
status: open
title: [subinterpreters] Unicode interned strings must not be shared between 
interpreters
versions: Python 3.11

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46283] [subinterpreters] Unicode interned strings must not be shared between interpreters

2022-01-06 Thread STINNER Victor


Change by STINNER Victor :


--
nosy: +eric.snow

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com