Message242391
| 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 |
<1430566943.66.0.184436382763.issue24102@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
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(). |
|