[Python-checkins] CVS: python/dist/src/Python errors.c,2.52,2.53

Fred L. Drake python-dev@python.org
Thu, 24 Aug 2000 15:38:41 -0700


Update of /cvsroot/python/python/dist/src/Python
In directory slayer.i.sourceforge.net:/tmp/cvs-serv23579/Python

Modified Files:
	errors.c 
Log Message:

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.


Index: errors.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/errors.c,v
retrieving revision 2.52
retrieving revision 2.53
diff -C2 -r2.52 -r2.53
*** errors.c	2000/08/18 18:01:06	2.52
--- errors.c	2000/08/24 22:38:39	2.53
***************
*** 370,378 ****
  
  void
  PyErr_BadInternalCall(void)
  {
! 	PyErr_SetString(PyExc_SystemError,
! 			"bad argument to internal function");
  }
  
  
--- 370,391 ----
  
  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_Format(PyExc_SystemError,
! 		     "bad argument to internal function");
  }
+ #define PyErr_BadInternalCall() _PyErr_BadInternalCall(__FILE__, __LINE__)
+