Julien Palard added the comment:

The inconcistencies were introduced in hg changeset 41703:7993f23ad46c, git 
commit:

commit 40ec96630b96f077c8b5746ab0ec038f95aede8b
Author: Walter Dörwald <wal...@livinglogic.de>
Date:   Sat May 12 11:08:06 2007 +0000

    Change PyUnicode_EncodeUnicodeEscape() to return a bytes object.
    However PyUnicode_AsUnicodeEscapeString() (which is used by
    Objects/fileobject.c::file_repr()) still returns a str8 object.
    Give unicode_repr() it's own implementation which returns a str8
    object (it was formerly just calling unicodeescape_string()
    which was used to implement PyUnicode_EncodeUnicodeEscape() too),
    because once repr() is required to return unicode objects it
    needs its own implementation anyway.

(PyUnicode_EncodeUnicodeEscape was the old name for 
PyUnicode_AsUnicodeEscapeString (since 
06ade3ac0d12beacd84382bd5fc8baf1c21c0e74).)

I searched in the documentation for "python string" and it looks like  
PyUnicode_EncodeCharmap is documented to return a string, but it returns bytes 
(same issue), therefore, the same issue happen for PyUnicode_AsCharmapString 
which uses PyUnicode_EncodeCharmap.

----------
nosy: +mdk

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

Reply via email to