comparison Python/pythonrun.c @ 59867:a366d631a629 3.1

Revert my change on initsite(): don't change import site error handler in 3.1, as I did for 2.6. But fix the other bugs :-)
author Victor Stinner <victor.stinner@haypocalc.com>
date Sun, 21 Mar 2010 21:57:42 +0000
parents c2d2e26bcf7f
children 677511edf05c
comparison
equal deleted inserted replaced
59865:c2d2e26bcf7f 59867:a366d631a629
710 /* Import the site module (not into __main__ though) */ 710 /* Import the site module (not into __main__ though) */
711 711
712 static void 712 static void
713 initsite(void) 713 initsite(void)
714 { 714 {
715 PyObject *m; 715 PyObject *m, *f;
716 m = PyImport_ImportModule("site"); 716 m = PyImport_ImportModule("site");
717 if (m == NULL) { 717 if (m == NULL) {
718 PyErr_Print(); 718 f = PySys_GetObject("stderr");
719 Py_Finalize(); 719 if (f == NULL || f == Py_None)
720 exit(1); 720 return;
721 if (Py_VerboseFlag) {
722 PyFile_WriteString(
723 "'import site' failed; traceback:\n", f);
724 PyErr_Print();
725 }
726 else {
727 PyFile_WriteString(
728 "'import site' failed; use -v for traceback\n", f);
729 PyErr_Clear();
730 }
721 } 731 }
722 else { 732 else {
723 Py_DECREF(m); 733 Py_DECREF(m);
724 } 734 }
725 } 735 }