Skip to content

Commit 24e643d

Browse files
authored
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.
1 parent c8deb1e commit 24e643d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Diff for: Python/pylifecycle.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -2348,7 +2348,7 @@ static PyStatus
23482348
add_main_module(PyInterpreterState *interp)
23492349
{
23502350
PyObject *m, *d, *ann_dict;
2351-
m = PyImport_AddModule("__main__");
2351+
m = PyImport_AddModuleObject(&_Py_ID(__main__));
23522352
if (m == NULL)
23532353
return _PyStatus_ERR("can't create __main__ module");
23542354

0 commit comments

Comments
 (0)