mirror of https://github.com/python/cpython
gh-118527: Use `_Py_ID(__main__)` for main module name (#118528)
Most module names are interned and immortalized, but the main module was not. This partially addresses a scaling bottleneck in the free-threaded when creating closure concurrently in the main module.
This commit is contained in:
parent
c8deb1e4b4
commit
24e643d4ef
|
@ -2348,7 +2348,7 @@ static PyStatus
|
||||||
add_main_module(PyInterpreterState *interp)
|
add_main_module(PyInterpreterState *interp)
|
||||||
{
|
{
|
||||||
PyObject *m, *d, *ann_dict;
|
PyObject *m, *d, *ann_dict;
|
||||||
m = PyImport_AddModule("__main__");
|
m = PyImport_AddModuleObject(&_Py_ID(__main__));
|
||||||
if (m == NULL)
|
if (m == NULL)
|
||||||
return _PyStatus_ERR("can't create __main__ module");
|
return _PyStatus_ERR("can't create __main__ module");
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue