summaryrefslogtreecommitdiff
path: root/Python/errors.c
diff options
context:
space:
mode:
authorFred Drake <fdrake@acm.org>2000-08-24 22:38:39 +0000
committerFred Drake <fdrake@acm.org>2000-08-24 22:38:39 +0000
commit8f097895e1c215df729772f6ed7f9948a75a1a42 (patch)
treedf37ad9d318c0f234028329598fa3566a368b0bc /Python/errors.c
parent45a0b2b0a5a223cebe99a810017455c335b867c1 (diff)
downloadcpython-8f097895e1c215df729772f6ed7f9948a75a1a42.tar.gz
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/errors.c')
-rw-r--r--Python/errors.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/Python/errors.c b/Python/errors.c
index ffa7f82f34..8486423479 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 *