Mercurial > cpython-lru_cache-weakref
comparison Python/pythonrun.c @ 40799:04f5cbc74424
Kill off softspace completely (except in formatter.py which seems to have
a different feature with the same name).
The change to test_doctest.txt reduces the doctest failures to 3.
| author | Guido van Rossum <guido@python.org> |
|---|---|
| date | Fri, 09 Feb 2007 23:20:19 +0000 |
| parents | 6ebad2a6b990 |
| children | e759fd8d95ae |
comparison
equal
deleted
inserted
replaced
| 40798:72277e1967b2 | 40799:04f5cbc74424 |
|---|---|
| 793 if (v == NULL) { | 793 if (v == NULL) { |
| 794 PyErr_Print(); | 794 PyErr_Print(); |
| 795 return -1; | 795 return -1; |
| 796 } | 796 } |
| 797 Py_DECREF(v); | 797 Py_DECREF(v); |
| 798 if (Py_FlushLine()) | |
| 799 PyErr_Clear(); | |
| 800 return 0; | 798 return 0; |
| 801 } | 799 } |
| 802 | 800 |
| 803 /* Check whether a file maybe a pyc file: Look at the extension, | 801 /* Check whether a file maybe a pyc file: Look at the extension, |
| 804 the file type, and, if we may close it, at the first few bytes. */ | 802 the file type, and, if we may close it, at the first few bytes. */ |
| 881 if (v == NULL) { | 879 if (v == NULL) { |
| 882 PyErr_Print(); | 880 PyErr_Print(); |
| 883 return -1; | 881 return -1; |
| 884 } | 882 } |
| 885 Py_DECREF(v); | 883 Py_DECREF(v); |
| 886 if (Py_FlushLine()) | |
| 887 PyErr_Clear(); | |
| 888 return 0; | 884 return 0; |
| 889 } | 885 } |
| 890 | 886 |
| 891 int | 887 int |
| 892 PyRun_SimpleStringFlags(const char *command, PyCompilerFlags *flags) | 888 PyRun_SimpleStringFlags(const char *command, PyCompilerFlags *flags) |
| 900 if (v == NULL) { | 896 if (v == NULL) { |
| 901 PyErr_Print(); | 897 PyErr_Print(); |
| 902 return -1; | 898 return -1; |
| 903 } | 899 } |
| 904 Py_DECREF(v); | 900 Py_DECREF(v); |
| 905 if (Py_FlushLine()) | |
| 906 PyErr_Clear(); | |
| 907 return 0; | 901 return 0; |
| 908 } | 902 } |
| 909 | 903 |
| 910 static int | 904 static int |
| 911 parse_syntax_error(PyObject *err, PyObject **message, const char **filename, | 905 parse_syntax_error(PyObject *err, PyObject **message, const char **filename, |
| 1016 { | 1010 { |
| 1017 PyObject *exception, *value, *tb; | 1011 PyObject *exception, *value, *tb; |
| 1018 int exitcode = 0; | 1012 int exitcode = 0; |
| 1019 | 1013 |
| 1020 PyErr_Fetch(&exception, &value, &tb); | 1014 PyErr_Fetch(&exception, &value, &tb); |
| 1021 if (Py_FlushLine()) | |
| 1022 PyErr_Clear(); | |
| 1023 fflush(stdout); | 1015 fflush(stdout); |
| 1024 if (value == NULL || value == Py_None) | 1016 if (value == NULL || value == Py_None) |
| 1025 goto done; | 1017 goto done; |
| 1026 if (PyExceptionInstance_Check(value)) { | 1018 if (PyExceptionInstance_Check(value)) { |
| 1027 /* The error code should be in the `code' attribute. */ | 1019 /* The error code should be in the `code' attribute. */ |
| 1095 } | 1087 } |
| 1096 if (v2 == NULL) { | 1088 if (v2 == NULL) { |
| 1097 v2 = Py_None; | 1089 v2 = Py_None; |
| 1098 Py_INCREF(v2); | 1090 Py_INCREF(v2); |
| 1099 } | 1091 } |
| 1100 if (Py_FlushLine()) | |
| 1101 PyErr_Clear(); | |
| 1102 fflush(stdout); | 1092 fflush(stdout); |
| 1103 PySys_WriteStderr("Error in sys.excepthook:\n"); | 1093 PySys_WriteStderr("Error in sys.excepthook:\n"); |
| 1104 PyErr_Display(exception2, v2, tb2); | 1094 PyErr_Display(exception2, v2, tb2); |
| 1105 PySys_WriteStderr("\nOriginal exception was:\n"); | 1095 PySys_WriteStderr("\nOriginal exception was:\n"); |
| 1106 PyErr_Display(exception, v, tb); | 1096 PyErr_Display(exception, v, tb); |
| 1126 PyObject *f = PySys_GetObject("stderr"); | 1116 PyObject *f = PySys_GetObject("stderr"); |
| 1127 Py_INCREF(value); | 1117 Py_INCREF(value); |
| 1128 if (f == NULL) | 1118 if (f == NULL) |
| 1129 fprintf(stderr, "lost sys.stderr\n"); | 1119 fprintf(stderr, "lost sys.stderr\n"); |
| 1130 else { | 1120 else { |
| 1131 if (Py_FlushLine()) | |
| 1132 PyErr_Clear(); | |
| 1133 fflush(stdout); | 1121 fflush(stdout); |
| 1134 if (tb && tb != Py_None) | 1122 if (tb && tb != Py_None) |
| 1135 err = PyTraceBack_Print(tb, f); | 1123 err = PyTraceBack_Print(tb, f); |
| 1136 if (err == 0 && | 1124 if (err == 0 && |
| 1137 PyObject_HasAttrString(value, "print_file_and_line")) | 1125 PyObject_HasAttrString(value, "print_file_and_line")) |
| 1595 PyErr_Print(); | 1583 PyErr_Print(); |
| 1596 } | 1584 } |
| 1597 Py_DECREF(exitfunc); | 1585 Py_DECREF(exitfunc); |
| 1598 } | 1586 } |
| 1599 | 1587 |
| 1600 if (Py_FlushLine()) | |
| 1601 PyErr_Clear(); | |
| 1602 } | 1588 } |
| 1603 | 1589 |
| 1604 static void | 1590 static void |
| 1605 call_ll_exitfuncs(void) | 1591 call_ll_exitfuncs(void) |
| 1606 { | 1592 { |
| 1853 } | 1839 } |
| 1854 | 1840 |
| 1855 #ifdef __cplusplus | 1841 #ifdef __cplusplus |
| 1856 } | 1842 } |
| 1857 #endif | 1843 #endif |
| 1858 |
