gh-132952: Speed up startup by importing _io instead of io (#132957)

This commit is contained in:
Jelle Zijlstra 2025-04-28 08:38:56 -07:00 committed by GitHub
parent 7f16f1bc11
commit 58567cc18c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 50 additions and 6 deletions

View file

@ -2755,7 +2755,7 @@ init_set_builtins_open(void)
goto error;
}
if (!(wrapper = PyImport_ImportModuleAttrString("io", "open"))) {
if (!(wrapper = PyImport_ImportModuleAttrString("_io", "open"))) {
goto error;
}
@ -2800,7 +2800,7 @@ init_sys_streams(PyThreadState *tstate)
}
#endif
if (!(iomod = PyImport_ImportModule("io"))) {
if (!(iomod = PyImport_ImportModule("_io"))) {
goto error;
}