GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||
GeezerVison is showing github.com — bpo-40521: Per-interpreter interned strings by vstinner · Pull Request #20085 · python/cpython Conversation
|
|
This change requires https://bugs.python.org/issue39465 to be fixed, and also to make the type method cache compatible with subinterpreters. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
With this PR, tests using subinterpreters like test_ast.test_subinterpreter() does crash since the method cache is built by default, whereas it shares interned strings between multiple interpreters. MCACHE must not be defined to test this PR, or the method cache must be fixed for subinterpreters. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
I rebased my PR on master. It is still a draft: PR #20058 must be merged first, and then the method cache must be fixed for subinterpreter, before we can consider to merge this PR. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
And I pushed a second fix for test_repl:
It's more an enhancement than a fix. Previously, the code also failed. It's just that previously, we didn't check if interned is NULL at exit, whereas my PR adds such assertion. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Make the Unicode dictionary of interned strings compatible with subinterpreters. Remove the INTERN_NAME_STRINGS macro in typeobject.c: names are always now interned (even if EXPERIMENTAL_ISOLATED_SUBINTERPRETERS macro is defined). _PyUnicode_ClearInterned() now uses PyDict_Next() to no longer allocate memory, to ensure that the interned dictionary is cleared.
Make the Unicode dictionary of interned strings compatible with subinterpreters. Remove the INTERN_NAME_STRINGS macro in typeobject.c: names are always now interned (even if EXPERIMENTAL_ISOLATED_SUBINTERPRETERS macro is defined). _PyUnicode_ClearInterned() now uses PyDict_Next() to no longer allocate memory, to ensure that the interned dictionary is cleared.
…GH-20085)" (GH-30422) (GH-30425) This reverts commit ea25180. Keep "assert(interned == NULL);" in _PyUnicode_Fini(), but only for the main interpreter. Keep _PyUnicode_ClearInterned() changes avoiding the creation of a temporary Python list object. Leave the PyInterpreterState structure unchanged to keep the ABI backward compatibility with Python 3.10.0: rename the "interned" member to "unused_interned". (cherry picked from commit 35d6540)
…". This reverts commit 35d6540.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.