diff 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
line wrap: on
line diff
--- a/Python/errors.c	Thu Aug 24 22:27:02 2000 +0000
+++ b/Python/errors.c	Thu Aug 24 22:38:39 2000 +0000
@@ -369,11 +369,24 @@
 #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 *