Skip to content

Commit 1513a2b

Browse files
committed
pythongh-118527: Use constant for __main__ name
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 4e2caf2 commit 1513a2b

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)