[Patches] [Patch #101214] Improve exception message for PyErr_BadInternalCall()

noreply@sourceforge.net noreply@sourceforge.net
Thu, 24 Aug 2000 15:39:31 -0700


Patch #101214 has been updated. 

Project: 
Category: core (C code)
Status: Closed
Summary: Improve exception message for PyErr_BadInternalCall()

Follow-Ups:

Date: 2000-Aug-17 23:25
By: fdrake

Comment:
This patch uses a macro wrapper to provide the filename and line number of the call to PyErr_BadInternalCall().  This should be reasonable since the __FILE__ and __LINE__ macros are ANSI C (I think).  There are 77 call sites for PyErr_BadInternalCall(), and this would make it a lot easier to get an initial foothold on errors generated through this function.
-------------------------------------------------------

Date: 2000-Aug-18 07:15
By: marangoz

Comment:
OTOH, bad internal calls shouldn't happen, but I like this. You want to
make my life easier as a developer, not as a user. +0, modulo the fact
that you removed the original function from the API. External modules
may fail. Let's keep the original function and its signature in the code.
(this requires some preprocessor trickery).
-------------------------------------------------------

Date: 2000-Aug-18 10:42
By: fdrake

Comment:
Add PyErr_BadInternalCall() entry point back for legacy compiled code, but continue to mask it for new code.
-------------------------------------------------------

Date: 2000-Aug-19 13:13
By: marangoz

Comment:
Where's the legacy PyErr_BadInternalCall(void) *function* ?
Try again :-)

error.c:

#undef PyErr_BadInternalCall
void
PyErr_BadInternalCall(void)
{
      PyErr_SetString(PyExc_SystemError,
                      "bad argument to internal function");
}

void
_PyErr_BadInternalCall(char *filename, int lineno)
{
      PyErr_Format(PyExc_SystemError,
                   "%s:%d: bad argument to internal function",
                   filename, lineno);
}
-------------------------------------------------------

Date: 2000-Aug-19 13:37
By: fdrake

Comment:
Ok, here 'tis... forgot to regenerate the patch before uploading it last time.  Sorry!  ;-(
-------------------------------------------------------

Date: 2000-Aug-20 00:24
By: tim_one

Comment:
Assigned to Vladimir since his is the natural next voice.
-------------------------------------------------------

Date: 2000-Aug-23 20:53
By: fdrake

Comment:
Assigned to Jeremy since Vladimir is away travelling for a bit.  Please review.
-------------------------------------------------------

Date: 2000-Aug-24 17:58
By: jhylton

Comment:
Looks good

-------------------------------------------------------

Date: 2000-Aug-24 18:39
By: fdrake

Comment:
Checked in.
-------------------------------------------------------

-------------------------------------------------------
For more info, visit:

http://sourceforge.net/patch/?func=detailpatch&patch_id=101214&group_id=5470