Georg Brandl added the comment:

I'm attaching a patch that works without changing the recursion limit, and adds 
some tests for pathological cases.

Instead, PyErr_GivenExceptionMatches is changed so that if an exception was 
previously set, it is replaced by an exception that PyObject_IsSubclass raises. 
 In that way recursion errors should be propagated properly.

In exception matching, this means that exceptions (including recursion errors) 
from PyObject_IsSubclass are ignored.  There is already an explicit test for 
this behavior in test_exceptions.

This behavior *could* be changed if intended by introducing a variant of 
PyErr_GivenExceptionMatches that can set an exception even if none was set 
before, and calling that in cmp_outcome in ceval.

----------
nosy: +georg.brandl
Added file: 
http://bugs.python.org/file36776/exception_proper_subclass_matching.patch

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue12029>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to