Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
gh-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.
  • Loading branch information
colesbury committed May 3, 2024
commit 1513a2bea07e93768165deb662cd2bae9f098b1e
2 changes: 1 addition & 1 deletion Python/pylifecycle.c
Original file line number Diff line number Diff line change
Expand Up @@ -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");

Expand Down