Skip to content

gh-100227: Make the Global Interned Dict Safe for Isolated Interpreters #102858

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

Prev Previous commit
Next Next commit
Add some TODO comments.
  • Loading branch information
ericsnowcurrently committed Mar 20, 2023
commit cca77b93b35b4a3037805fb1a239ec9ad22a518d
6 changes: 6 additions & 0 deletions Objects/unicodeobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -14610,17 +14610,23 @@ PyUnicode_InternInPlace(PyObject **p)
PyObject *interned = get_interned_dict();
assert(interned != NULL);

// XXX Swap to the main interpreter.

PyObject *t = PyDict_SetDefault(interned, s, s);
if (t == NULL) {
PyErr_Clear();
return;
}

// XXX Swap back.

if (t != s) {
Py_SETREF(*p, Py_NewRef(t));
return;
}

// XXX Immortalize the object.

/* The two references in interned dict (key and value) are not counted by
refcnt. unicode_dealloc() and _PyUnicode_ClearInterned() take care of
this. */
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