Skip to content

bpo-46006: Move the interned strings and identifiers to _PyRuntimeState. #30131

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Only clean up it it's the main interpreter.
  • Loading branch information
ericsnowcurrently committed Dec 17, 2021
commit 58d9c0beef998ce8f320ed33700e8a54222e9f44
10 changes: 8 additions & 2 deletions Objects/unicodeobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -2388,8 +2388,11 @@ _PyUnicode_FromId(_Py_Identifier *id)


static void
unicode_clear_identifiers(void)
unicode_clear_identifiers(PyInterpreterState *interp)
{
if (!_Py_IsMainInterpreter(interp)) {
return;
}
for (Py_ssize_t i=0; i < IDENTIFIERS.size; i++) {
Py_XDECREF(IDENTIFIERS.array[i]);
}
Expand Down Expand Up @@ -15653,6 +15656,9 @@ PyUnicode_InternFromString(const char *cp)
void
_PyUnicode_ClearInterned(PyInterpreterState *interp)
{
if (!_Py_IsMainInterpreter(interp)) {
return;
}
if (INTERNED == NULL) {
return;
}
Expand Down Expand Up @@ -16088,7 +16094,7 @@ _PyUnicode_Fini(PyInterpreterState *interp)

_PyUnicode_FiniEncodings(&state->fs_codec);

unicode_clear_identifiers();
unicode_clear_identifiers(interp);

for (Py_ssize_t i = 0; i < 256; i++) {
Py_CLEAR(state->latin1[i]);
Expand Down
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy