Mercurial > cpython-lru_cache-weakref
comparison Python/errors.c @ 86999:01c4a0af73cf
Issue #19512, #19515: remove shared identifiers, move identifiers where they
are used.
Move also _Py_IDENTIFIER() defintions to the top in modified files to remove
identifiers duplicated in the same file.
| author | Victor Stinner <victor.stinner@gmail.com> |
|---|---|
| date | Thu, 07 Nov 2013 23:07:29 +0100 |
| parents | 77bebcf5c4cf |
| children |
comparison
equal
deleted
inserted
replaced
| 86998:23f0529a8b2f | 86999:01c4a0af73cf |
|---|---|
| 17 #include <ctype.h> | 17 #include <ctype.h> |
| 18 | 18 |
| 19 #ifdef __cplusplus | 19 #ifdef __cplusplus |
| 20 extern "C" { | 20 extern "C" { |
| 21 #endif | 21 #endif |
| 22 | |
| 23 _Py_IDENTIFIER(builtins); | |
| 24 _Py_IDENTIFIER(stderr); | |
| 22 | 25 |
| 23 | 26 |
| 24 void | 27 void |
| 25 PyErr_Restore(PyObject *type, PyObject *value, PyObject *traceback) | 28 PyErr_Restore(PyObject *type, PyObject *value, PyObject *traceback) |
| 26 { | 29 { |
| 842 PyObject *moduleName = NULL; | 845 PyObject *moduleName = NULL; |
| 843 char* className; | 846 char* className; |
| 844 | 847 |
| 845 PyErr_Fetch(&t, &v, &tb); | 848 PyErr_Fetch(&t, &v, &tb); |
| 846 | 849 |
| 847 f = _PySys_GetObjectId(&_PyId_stderr); | 850 f = _PySys_GetObjectId(&PyId_stderr); |
| 848 if (f == NULL || f == Py_None) | 851 if (f == NULL || f == Py_None) |
| 849 goto done; | 852 goto done; |
| 850 | 853 |
| 851 if (obj) { | 854 if (obj) { |
| 852 if (PyFile_WriteString("Exception ignored in: ", f) < 0) | 855 if (PyFile_WriteString("Exception ignored in: ", f) < 0) |
| 876 PyErr_Clear(); | 879 PyErr_Clear(); |
| 877 if (PyFile_WriteString("<unknown>", f) < 0) | 880 if (PyFile_WriteString("<unknown>", f) < 0) |
| 878 goto done; | 881 goto done; |
| 879 } | 882 } |
| 880 else { | 883 else { |
| 881 if (_PyUnicode_CompareWithId(moduleName, &_PyId_builtins) != 0) { | 884 if (_PyUnicode_CompareWithId(moduleName, &PyId_builtins) != 0) { |
| 882 if (PyFile_WriteObject(moduleName, f, Py_PRINT_RAW) < 0) | 885 if (PyFile_WriteObject(moduleName, f, Py_PRINT_RAW) < 0) |
| 883 goto done; | 886 goto done; |
| 884 if (PyFile_WriteString(".", f) < 0) | 887 if (PyFile_WriteString(".", f) < 0) |
| 885 goto done; | 888 goto done; |
| 886 } | 889 } |
