Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 5bfba3a

Browse files
committed
Addendum to #683658:
import warnings.py _after_ site.py has run. This ensures that site.py is again the first .py to be imported, giving it back full control over sys.path.
1 parent 7322b1a commit 5bfba3a

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

Python/pythonrun.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,13 +174,13 @@ Py_Initialize(void)
174174

175175
_PyImportHooks_Init();
176176

177-
PyModule_WarningsModule = PyImport_ImportModule("warnings");
178-
179177
initsigs(); /* Signal handling stuff, including initintr() */
180178

181179
initmain(); /* Module __main__ */
182180
if (!Py_NoSiteFlag)
183181
initsite(); /* Module site */
182+
183+
PyModule_WarningsModule = PyImport_ImportModule("warnings");
184184
}
185185

186186
#ifdef COUNT_ALLOCS

0 commit comments

Comments
 (0)