Serhiy Storchaka added the comment:

Here is simpler reproducer:

import codecs

class X(str):
    __class__ = UnicodeEncodeError

codecs.ignore_errors(X())

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().

----------
assignee:  -> serhiy.storchaka
stage: needs patch -> patch review

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

Reply via email to