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:
@@ -2348,7 +2348,7 @@ static PyStatus
|
||||
add_main_module(PyInterpreterState *interp)
|
||||
{
|
||||
PyObject *m, *d, *ann_dict;
|
||||
m = PyImport_AddModule("__main__");
|
||||
m = PyImport_AddModuleObject(&_Py_ID(__main__));
|
||||
if (m == NULL)
|
||||
return _PyStatus_ERR("can't create __main__ module");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user