Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(93166)

Unified Diff: Objects/abstract.c

Issue 1574217: isinstance swallows exceptions
Patch Set: Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Lib/test/test_isinstance.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Objects/abstract.c
===================================================================
--- Objects/abstract.c (revision 82887)
+++ Objects/abstract.c (working copy)
@@ -2508,7 +2508,12 @@
if (retval == 0) {
PyObject *c = PyObject_GetAttr(inst, __class__);
if (c == NULL) {
- PyErr_Clear();
+ if(PyErr_ExceptionMatches(PyExc_AttributeError)) {
+ PyErr_Clear();
+ }
+ else {
+ retval = -1;
+ }
}
else {
if (c != (PyObject *)(inst->ob_type) &&
@@ -2526,8 +2531,12 @@
return -1;
icls = PyObject_GetAttr(inst, __class__);
if (icls == NULL) {
- PyErr_Clear();
- retval = 0;
+ if(PyErr_ExceptionMatches(PyExc_AttributeError)) {
+ PyErr_Clear();
+ }
+ else {
+ retval = -1;
+ }
}
else {
retval = abstract_issubclass(icls, cls);
« no previous file with comments | « Lib/test/test_isinstance.py ('k') | no next file » | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+