comparison Python/pythonrun.c @ 61776:3271af035d01 3.1

Recorded merge of revisions 81364 via svnmerge from svn+ssh://pythondev@svn.python.org/python/branches/py3k ........ r81364 | victor.stinner | 2010-05-19 22:40:50 +0200 (mer., 19 mai 2010) | 3 lines 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 Thu, 20 May 2010 21:00:34 +0000
parents ca81646dd29c
children f83f201b1276
comparison
equal deleted inserted replaced
61769:fd72af0060c8 61776:3271af035d01
262 262
263 _PyImport_Init(); 263 _PyImport_Init();
264 264
265 _PyImportHooks_Init(); 265 _PyImportHooks_Init();
266 266
267 /* Initialize _warnings. */
268 _PyWarnings_Init();
269
267 #if defined(HAVE_LANGINFO_H) && defined(CODESET) 270 #if defined(HAVE_LANGINFO_H) && defined(CODESET)
268 /* On Unix, set the file system encoding according to the 271 /* On Unix, set the file system encoding according to the
269 user's preference, if the CODESET names a well-known 272 user's preference, if the CODESET names a well-known
270 Python codec, and Py_FileSystemDefaultEncoding isn't 273 Python codec, and Py_FileSystemDefaultEncoding isn't
271 initialized by other means. Also set the encoding of 274 initialized by other means. Also set the encoding of
282 285
283 if (install_sigs) 286 if (install_sigs)
284 initsigs(); /* Signal handling stuff, including initintr() */ 287 initsigs(); /* Signal handling stuff, including initintr() */
285 288
286 /* Initialize warnings. */ 289 /* Initialize warnings. */
287 _PyWarnings_Init();
288 if (PySys_HasWarnOptions()) { 290 if (PySys_HasWarnOptions()) {
289 PyObject *warnings_module = PyImport_ImportModule("warnings"); 291 PyObject *warnings_module = PyImport_ImportModule("warnings");
290 if (!warnings_module) 292 if (!warnings_module)
291 PyErr_Clear(); 293 PyErr_Clear();
292 Py_XDECREF(warnings_module); 294 Py_XDECREF(warnings_module);