Skip to content

Commit

Permalink
pythongh-118527: Intern code name and filename on default build (pyth…
Browse files Browse the repository at this point in the history
…on#118576)

Interned and non-interned strings are treated differently by `marshal`,
so be consistent between the default and free-threaded build.
  • Loading branch information
colesbury committed May 6, 2024
1 parent 616b745 commit 2ba2c14
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
2 changes: 0 additions & 2 deletions Objects/codeobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -390,11 +390,9 @@ 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;
Expand Down
4 changes: 2 additions & 2 deletions Programs/test_frozenmain.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 2ba2c14

Please sign in to comment.