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

Skip to content

Commit 9a68f8c

Browse files
committed
Moved the initalization of the exception before the initialization of sys.
On Windows _PySys_Init() could raise an uninitialized exception which leads to a seg fault.
1 parent eb9b39b commit 9a68f8c

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

Python/pythonrun.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,9 @@ Py_InitializeEx(int install_sigs)
217217
Py_FatalError("Py_Initialize: can't initialize builtins dict");
218218
Py_INCREF(interp->builtins);
219219

220+
/* initialize builtin exceptions */
221+
_PyExc_Init();
222+
220223
sysmod = _PySys_Init();
221224
if (sysmod == NULL)
222225
Py_FatalError("Py_Initialize: can't initialize sys");
@@ -239,9 +242,6 @@ Py_InitializeEx(int install_sigs)
239242

240243
_PyImport_Init();
241244

242-
/* initialize builtin exceptions */
243-
_PyExc_Init();
244-
245245
/* phase 2 of builtins */
246246
_PyImport_FixupExtension("__builtin__", "__builtin__");
247247

0 commit comments

Comments
 (0)