diff options
author | Fred Drake <fdrake@acm.org> | 2000-08-24 22:38:39 (GMT) |
---|---|---|
committer | Fred Drake <fdrake@acm.org> | 2000-08-24 22:38:39 (GMT) |
commit | 6d63adfbb7e97b218bede1052d3826b3461e9c59 (patch) | |
tree | a586109a41da3627dee96786ace955b43e58db43 /Python | |
parent | 9ed49e979f342d0341d0208ea1ee12ad80835a91 (diff) | |
download | cpython-6d63adfbb7e97b218bede1052d3826b3461e9c59.zip cpython-6d63adfbb7e97b218bede1052d3826b3461e9c59.tar.gz cpython-6d63adfbb7e97b218bede1052d3826b3461e9c59.tar.bz2 |
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.
Diffstat (limited to 'Python')
-rw-r--r-- | Python/errors.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/Python/errors.c b/Python/errors.c index ffa7f82..8486423 100644 --- a/Python/errors.c +++ b/Python/errors.c @@ -369,11 +369,24 @@ PyObject *PyErr_SetFromWindowsErr(int ierr) #endif /* MS_WINDOWS */ void +_PyErr_BadInternalCall(char *filename, int lineno) +{ + PyErr_Format(PyExc_SystemError, + "%s:%d: bad argument to internal function", + filename, lineno); +} + +/* Remove the preprocessor macro for PyErr_BadInternalCall() so that we can + export the entry point for existing object code: */ +#undef PyErr_BadInternalCall +void PyErr_BadInternalCall(void) { - PyErr_SetString(PyExc_SystemError, - "bad argument to internal function"); + PyErr_Format(PyExc_SystemError, + "bad argument to internal function"); } +#define PyErr_BadInternalCall() _PyErr_BadInternalCall(__FILE__, __LINE__) + PyObject * |