Skip to content

Commit 2ba2c14

Browse files
authored
gh-118527: Intern code name and filename on default build (#118576)
Interned and non-interned strings are treated differently by `marshal`, so be consistent between the default and free-threaded build.
1 parent 616b745 commit 2ba2c14

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

Objects/codeobject.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -390,11 +390,9 @@ init_code(PyCodeObject *co, struct _PyCodeConstructor *con)
390390
co->co_filename = Py_NewRef(con->filename);
391391
co->co_name = Py_NewRef(con->name);
392392
co->co_qualname = Py_NewRef(con->qualname);
393-
#ifdef Py_GIL_DISABLED
394393
PyUnicode_InternInPlace(&co->co_filename);
395394
PyUnicode_InternInPlace(&co->co_name);
396395
PyUnicode_InternInPlace(&co->co_qualname);
397-
#endif
398396
co->co_flags = con->flags;
399397

400398
co->co_firstlineno = con->firstlineno;

Programs/test_frozenmain.h

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)