mirror of https://github.com/python/cpython
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.
This commit is contained in:
parent
616b745b89
commit
2ba2c142a6
|
@ -390,11 +390,9 @@ init_code(PyCodeObject *co, struct _PyCodeConstructor *con)
|
||||||
co->co_filename = Py_NewRef(con->filename);
|
co->co_filename = Py_NewRef(con->filename);
|
||||||
co->co_name = Py_NewRef(con->name);
|
co->co_name = Py_NewRef(con->name);
|
||||||
co->co_qualname = Py_NewRef(con->qualname);
|
co->co_qualname = Py_NewRef(con->qualname);
|
||||||
#ifdef Py_GIL_DISABLED
|
|
||||||
PyUnicode_InternInPlace(&co->co_filename);
|
PyUnicode_InternInPlace(&co->co_filename);
|
||||||
PyUnicode_InternInPlace(&co->co_name);
|
PyUnicode_InternInPlace(&co->co_name);
|
||||||
PyUnicode_InternInPlace(&co->co_qualname);
|
PyUnicode_InternInPlace(&co->co_qualname);
|
||||||
#endif
|
|
||||||
co->co_flags = con->flags;
|
co->co_flags = con->flags;
|
||||||
|
|
||||||
co->co_firstlineno = con->firstlineno;
|
co->co_firstlineno = con->firstlineno;
|
||||||
|
|
|
@ -25,8 +25,8 @@ unsigned char M_test_frozenmain[] = {
|
||||||
108,99,97,112,105,218,5,112,114,105,110,116,218,4,97,114,
|
108,99,97,112,105,218,5,112,114,105,110,116,218,4,97,114,
|
||||||
103,118,218,11,103,101,116,95,99,111,110,102,105,103,115,114,
|
103,118,218,11,103,101,116,95,99,111,110,102,105,103,115,114,
|
||||||
3,0,0,0,218,3,107,101,121,169,0,243,0,0,0,0,
|
3,0,0,0,218,3,107,101,121,169,0,243,0,0,0,0,
|
||||||
250,18,116,101,115,116,95,102,114,111,122,101,110,109,97,105,
|
218,18,116,101,115,116,95,102,114,111,122,101,110,109,97,105,
|
||||||
110,46,112,121,250,8,60,109,111,100,117,108,101,62,114,18,
|
110,46,112,121,218,8,60,109,111,100,117,108,101,62,114,18,
|
||||||
0,0,0,1,0,0,0,115,99,0,0,0,240,3,1,1,
|
0,0,0,1,0,0,0,115,99,0,0,0,240,3,1,1,
|
||||||
1,243,8,0,1,11,219,0,24,225,0,5,208,6,26,212,
|
1,243,8,0,1,11,219,0,24,225,0,5,208,6,26,212,
|
||||||
0,27,217,0,5,128,106,144,35,151,40,145,40,212,0,27,
|
0,27,217,0,5,128,106,144,35,151,40,145,40,212,0,27,
|
||||||
|
|
Loading…
Reference in New Issue