This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author serhiy.storchaka
Recipients christian.heimes, doerwalter, ezio.melotti, lemburg, pkt, serhiy.storchaka, vstinner
Date 2015-05-02.11:42:23
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
Here is simpler reproducer:

import codecs

class X(str):
    __class__ = UnicodeEncodeError


The problem is that PyObject_IsInstance() is fooled by custom __class__, but then builtin error handlers handle error object as having UnicodeEncodeError layout, while it doesn't.

Here is a patch that fixes the issue by using PyObject_IsSubclass() of exc->ob_type instead of PyObject_IsInstance().
Date User Action Args
2015-05-02 11:42:23serhiy.storchakasetrecipients: + serhiy.storchaka, lemburg, doerwalter, vstinner, christian.heimes, ezio.melotti, pkt
2015-05-02 11:42:23serhiy.storchakasetmessageid: <>
2015-05-02 11:42:23serhiy.storchakalinkissue24102 messages
2015-05-02 11:42:23serhiy.storchakacreate