diff Python/pythonrun.c @ 78341:2f1494d243ad

Fix initialization of the faulthandler module faulthandler requires the importlib if "-X faulthandler" option is present on the command line, so initialize faulthandler after importlib. Add also an unit test.
author Victor Stinner <victor.stinner@gmail.com>
date Tue, 31 Jul 2012 02:55:49 +0200
parents 27e13497d545
children c55dbb84f3b4
line wrap: on
line diff
--- a/Python/pythonrun.c	Mon Jul 30 19:31:00 2012 -0400
+++ b/Python/pythonrun.c	Tue Jul 31 02:55:49 2012 +0200
@@ -356,10 +356,6 @@
 
     _PyImportHooks_Init();
 
-    /* initialize the faulthandler module */
-    if (_PyFaulthandler_Init())
-        Py_FatalError("Py_Initialize: can't initialize faulthandler");
-
     /* Initialize _warnings. */
     _PyWarnings_Init();
 
@@ -368,6 +364,10 @@
 
     import_init(interp, sysmod);
 
+    /* initialize the faulthandler module */
+    if (_PyFaulthandler_Init())
+        Py_FatalError("Py_Initialize: can't initialize faulthandler");
+
     _PyTime_Init();
 
     if (initfsencoding(interp) < 0)