comparison Python/pythonrun.c @ 61757:deed5fce82d6

Issue #8766: Initialize _warnings module before importing the first module. Fix a crash if an empty directory called "encodings" exists in sys.path.
author Victor Stinner <victor.stinner@haypocalc.com>
date Wed, 19 May 2010 20:40:50 +0000
parents 942b3c168f15
children 815ba3872f85
comparison
equal deleted inserted replaced
61754:e5fde7ad1b7c 61757:deed5fce82d6
263 263
264 _PyImport_Init(); 264 _PyImport_Init();
265 265
266 _PyImportHooks_Init(); 266 _PyImportHooks_Init();
267 267
268 /* Initialize _warnings. */
269 _PyWarnings_Init();
270
268 initfsencoding(); 271 initfsencoding();
269 272
270 if (install_sigs) 273 if (install_sigs)
271 initsigs(); /* Signal handling stuff, including initintr() */ 274 initsigs(); /* Signal handling stuff, including initintr() */
272 275
273 /* Initialize warnings. */ 276 /* Initialize warnings. */
274 _PyWarnings_Init();
275 if (PySys_HasWarnOptions()) { 277 if (PySys_HasWarnOptions()) {
276 PyObject *warnings_module = PyImport_ImportModule("warnings"); 278 PyObject *warnings_module = PyImport_ImportModule("warnings");
277 if (!warnings_module) 279 if (!warnings_module)
278 PyErr_Clear(); 280 PyErr_Clear();
279 Py_XDECREF(warnings_module); 281 Py_XDECREF(warnings_module);