STINNER Victor added the comment:

Ok, I fixed the bug in Python 2.7, 3.4, 3.5 and 3.6. (Python 2.7 was also 
impacted for custom *unicode* strings.)

Thanks for your bug report paul!

> ISTM this is a case where Python's core shouldn't be using assert. It's 
> possible for userland code to trigger an assertion failure, which means it 
> should be a regular if(..) raise.

Right, this check is implemented in PyUnicode_AsEncodedString(). Moreover, 
PyUnicode_AsEncodedString() calls directly the codec, it doesn't call the 
encode() method of the input string.

(Sorry, I wrote PyUnicode_AsEncodedObject() which has a different purpose.)

> @haypo, what do you mean by "fuzzing"?

This: https://en.wikipedia.org/wiki/Fuzz_testing

----------
resolution:  -> fixed
status: open -> closed
versions: +Python 2.7

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

Reply via email to