aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Python/pylifecycle.c
diff options
context:
space:
mode:
authorSam Gross <colesbury@gmail.com>2024-05-03 11:05:30 -0400
committerGitHub <noreply@github.com>2024-05-03 11:05:30 -0400
commit24e643d4ef024a3561c927dc07c59c435bb27bcc (patch)
treee24d3a2e89c2705512b3c2b27ae8bade860db47f /Python/pylifecycle.c
parentc8deb1e4b495bf97ab00c710dfd63f227e1fb645 (diff)
downloadcpython-24e643d4ef024a3561c927dc07c59c435bb27bcc.tar.gz
cpython-24e643d4ef024a3561c927dc07c59c435bb27bcc.zip
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.
Diffstat (limited to 'Python/pylifecycle.c')
-rw-r--r--Python/pylifecycle.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/Python/pylifecycle.c b/Python/pylifecycle.c
index 7726ccc979d..9dc6e3f3112 100644
--- a/Python/pylifecycle.c
+++ b/Python/pylifecycle.c
@@ -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");