Skip to content

Commit 0fec708

Browse files
colesburySonicField
authored andcommitted
pythongh-118527: Use _Py_ID(__main__) for main module name (python#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 48b5ec7 commit 0fec708

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎Python/pylifecycle.c‎

Lines changed: 1 addition & 1 deletion
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)