[issue25448] Exception ABC doesn't work in Python 3 (but does in Python 2.7)

2015-10-20 Thread eryksun
Changes by eryksun : -- resolution: -> duplicate stage: -> resolved status: open -> closed superseder: -> Catching virtual subclasses in except clauses ___ Python tracker ___

[issue25448] Exception ABC doesn't work in Python 3 (but does in Python 2.7)

2015-10-20 Thread Medardo Rodriguez
Medardo Rodriguez added the comment: Josh Rosenberg, you are right, it's a duplication. Sorry I didn't find the issue #12029 before. -- ___ Python tracker ___ __

[issue25448] Exception ABC doesn't work in Python 3 (but does in Python 2.7)

2015-10-20 Thread Josh Rosenberg
Josh Rosenberg added the comment: This looks like a duplicate of #12029. The delays on addressing that bug seem to indicate that initially there was a fairly substantial performance cost for all exception handling paths when ABC friendly checking was performed, but that was at least partially

[issue25448] Exception ABC doesn't work in Python 3 (but does in Python 2.7)

2015-10-20 Thread Medardo Rodriguez
Medardo Rodriguez added the comment: Thanks ~eryksun, you clarified me in where the error is located and possible patches for it. We are programming a framework where is very important to do mappings between (1) the API and (2) the drivers layers. We try to make our code available to both bra

[issue25448] Exception ABC doesn't work in Python 3 (but does in Python 2.7)

2015-10-20 Thread eryksun
eryksun added the comment: In Python 2, PyErr_GivenExceptionMatches [1] calls PyObject_IsSubclass. To handle calling __subclasscheck__ in this case, 2.7 (but not 2.6) temporarily increases the recursion limit by 5. For example: class CMeta(type): def __subclasscheck__(self, other):

[issue25448] Exception ABC doesn't work in Python 3 (but does in Python 2.7)

2015-10-20 Thread R. David Murray
R. David Murray added the comment: Thinking about this some more my explanation isn't quite clear (because my thinking wasn't quite clear): the problem isn't that APIError isn't *capable* of being a base class; I was wrong when I said it is itself a metaclass. It is a class that has ABCMeta *

[issue25448] Exception ABC doesn't work in Python 3 (but does in Python 2.7)

2015-10-20 Thread R. David Murray
R. David Murray added the comment: What are you trying to accomplish that needs an abstract base class? APIError is not an Exception class, it is a meta-class, and thus it does not match the exception because it is not a *base* class of DriverError (it is DiverError's *meta* class). Now, it i

[issue25448] Exception ABC doesn't work in Python 3 (but does in Python 2.7)

2015-10-20 Thread Medardo Rodriguez
New submission from Medardo Rodriguez: When I run the next code in all my installed versions of Python 3 (and the equivalent code for PyPy and CPython 2.7): - Runs OK in CPython 2.7 equivalent code (using `ABCMeta` as meta-class). - Fails in PyPy and all versions of Python 3. -- files