diff --git a/Objects/codeobject.c b/Objects/codeobject.c index 7d02b038cf5..15d3960fc2d 100644 --- a/Objects/codeobject.c +++ b/Objects/codeobject.c @@ -390,6 +390,11 @@ init_code(PyCodeObject *co, struct _PyCodeConstructor *con) co->co_filename = Py_NewRef(con->filename); co->co_name = Py_NewRef(con->name); co->co_qualname = Py_NewRef(con->qualname); +#ifdef Py_GIL_DISABLED + PyUnicode_InternInPlace(&co->co_filename); + PyUnicode_InternInPlace(&co->co_name); + PyUnicode_InternInPlace(&co->co_qualname); +#endif co->co_flags = con->flags; co->co_firstlineno = con->firstlineno;