From 24e643d4ef024a3561c927dc07c59c435bb27bcc Mon Sep 17 00:00:00 2001 From: Sam Gross Date: Fri, 3 May 2024 11:05:30 -0400 Subject: 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. --- Python/pylifecycle.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Python') 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"); -- cgit v1.2.3