Mercurial > cpython-lru_cache-weakref
comparison Python/pythonrun.c @ 48839:587cd4f66c2d
fix #3653 Python could segfault if invalid values were passed to sys.excepthook
Author: Daniel Diniz
Reviewer: Georg Brandl
| author | Benjamin Peterson <benjamin@python.org> |
|---|---|
| date | Sat, 23 Aug 2008 20:08:07 +0000 |
| parents | 85b67fb5672b |
| children | 4db1f5098175 |
comparison
equal
deleted
inserted
replaced
| 48838:e7b85890e9b1 | 48839:587cd4f66c2d |
|---|---|
| 1297 static void | 1297 static void |
| 1298 print_exception(PyObject *f, PyObject *value) | 1298 print_exception(PyObject *f, PyObject *value) |
| 1299 { | 1299 { |
| 1300 int err = 0; | 1300 int err = 0; |
| 1301 PyObject *type, *tb; | 1301 PyObject *type, *tb; |
| 1302 | |
| 1303 if (!PyExceptionInstance_Check(value)) { | |
| 1304 PyFile_WriteString("TypeError: print_exception(): Exception expected for value, ", f); | |
| 1305 PyFile_WriteString(Py_TYPE(value)->tp_name, f); | |
| 1306 PyFile_WriteString(" found\n", f); | |
| 1307 return; | |
| 1308 } | |
| 1302 | 1309 |
| 1303 Py_INCREF(value); | 1310 Py_INCREF(value); |
| 1304 fflush(stdout); | 1311 fflush(stdout); |
| 1305 type = (PyObject *) Py_TYPE(value); | 1312 type = (PyObject *) Py_TYPE(value); |
| 1306 tb = PyException_GetTraceback(value); | 1313 tb = PyException_GetTraceback(value); |
