Mercurial > cpython-lru_cache-weakref
comparison Python/errors.c @ 14170:019265b3a856 legacy-trunk
Improve the exceptions raised by PyErr_BadInternalCall(); adding the
filename and line number of the call site to allow esier debugging.
This closes SourceForge patch #101214.
| author | Fred Drake <fdrake@acm.org> |
|---|---|
| date | Thu, 24 Aug 2000 22:38:39 +0000 |
| parents | 25eea88047e9 |
| children | 6dee1985c681 |
comparison
equal
deleted
inserted
replaced
| 14169:b8eadeed8ed3 | 14170:019265b3a856 |
|---|---|
| 367 | 367 |
| 368 } | 368 } |
| 369 #endif /* MS_WINDOWS */ | 369 #endif /* MS_WINDOWS */ |
| 370 | 370 |
| 371 void | 371 void |
| 372 _PyErr_BadInternalCall(char *filename, int lineno) | |
| 373 { | |
| 374 PyErr_Format(PyExc_SystemError, | |
| 375 "%s:%d: bad argument to internal function", | |
| 376 filename, lineno); | |
| 377 } | |
| 378 | |
| 379 /* Remove the preprocessor macro for PyErr_BadInternalCall() so that we can | |
| 380 export the entry point for existing object code: */ | |
| 381 #undef PyErr_BadInternalCall | |
| 382 void | |
| 372 PyErr_BadInternalCall(void) | 383 PyErr_BadInternalCall(void) |
| 373 { | 384 { |
| 374 PyErr_SetString(PyExc_SystemError, | 385 PyErr_Format(PyExc_SystemError, |
| 375 "bad argument to internal function"); | 386 "bad argument to internal function"); |
| 376 } | 387 } |
| 388 #define PyErr_BadInternalCall() _PyErr_BadInternalCall(__FILE__, __LINE__) | |
| 389 | |
| 377 | 390 |
| 378 | 391 |
| 379 PyObject * | 392 PyObject * |
| 380 PyErr_Format(PyObject *exception, const char *format, ...) | 393 PyErr_Format(PyObject *exception, const char *format, ...) |
| 381 { | 394 { |
