[ python-Bugs-1574217 ] isinstance swallows exceptions

SourceForge.net noreply at sourceforge.net
Tue Oct 10 04:56:31 CEST 2006


Bugs item #1574217, was opened at 2006-10-09 21:55
Message generated for change (Comment added) made by ferringb
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1574217&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Brian Harring (ferringb)
Assigned to: Nobody/Anonymous (nobody)
Summary: isinstance swallows exceptions

Initial Comment:
Attached is a simple example; yes, a bit contrived, but
it's exactly what bit me in the ass for a week or two :)

nestled within abstract.c's recursive_isinstance, is
this lil nugget-

icls = PyObject_GetAttr(inst, __class__);
if (icls == NULL) {
  PyErr_Clear();
  retval = 0;
}
else {

No surrouding comments to indicate *why* it's
swallowing exceptions, but best explanation I've heard
was that it was attempting to swallow just
AttributeError... which would make sense.

So the question is, whats the purpose of it swallowing
exceptions there?  Bad form of AttributeError catching,
or some unstated reason?

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

>Comment By: Brian Harring (ferringb)
Date: 2006-10-09 21:56

Message:
Logged In: YES 
user_id=874085

addition note; this is both 2.5 and 2.4, probably stretches
bit further back also.

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

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1574217&group_id=5470


More information about the Python-bugs-list mailing list