comparison Python/pythonrun.c @ 66137:06f76ef27f86

Issue #10372: Import the warnings module only after the IO library is initialized, so as to avoid bootstrap issues with the '-W' option.
author Antoine Pitrou <solipsis@pitrou.net>
date Wed, 10 Nov 2010 13:55:25 +0000
parents ea14977a36de
children 6eabf8c1a75c
comparison
equal deleted inserted replaced
66134:e02758e552e9 66137:06f76ef27f86
297 initfsencoding(); 297 initfsencoding();
298 298
299 if (install_sigs) 299 if (install_sigs)
300 initsigs(); /* Signal handling stuff, including initintr() */ 300 initsigs(); /* Signal handling stuff, including initintr() */
301 301
302 /* Initialize warnings. */
303 if (PySys_HasWarnOptions()) {
304 PyObject *warnings_module = PyImport_ImportModule("warnings");
305 if (!warnings_module)
306 PyErr_Clear();
307 Py_XDECREF(warnings_module);
308 }
309
310 initmain(); /* Module __main__ */ 302 initmain(); /* Module __main__ */
311 if (initstdio() < 0) 303 if (initstdio() < 0)
312 Py_FatalError( 304 Py_FatalError(
313 "Py_Initialize: can't initialize sys standard streams"); 305 "Py_Initialize: can't initialize sys standard streams");
306
307 /* Initialize warnings. */
308 if (PySys_HasWarnOptions()) {
309 PyObject *warnings_module = PyImport_ImportModule("warnings");
310 if (warnings_module == NULL) {
311 fprintf(stderr, "'import warnings' failed; traceback:\n");
312 PyErr_Print();
313 }
314 Py_XDECREF(warnings_module);
315 }
314 316
315 if (!Py_NoSiteFlag) 317 if (!Py_NoSiteFlag)
316 initsite(); /* Module site */ 318 initsite(); /* Module site */
317 } 319 }
318 320