From 6d63adfbb7e97b218bede1052d3826b3461e9c59 Mon Sep 17 00:00:00 2001 From: Fred Drake Date: Thu, 24 Aug 2000 22:38:39 +0000 Subject: 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. --- Python/errors.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'Python/errors.c') diff --git a/Python/errors.c b/Python/errors.c index ffa7f82f34..8486423479 100644 --- a/Python/errors.c +++ b/Python/errors.c @@ -368,12 +368,25 @@ 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 * -- cgit v1.2.1