Walter Dörwald added the comment:

And returning bytes is documented in PEP 383, as an extension to the PEP 293 
machinery:

"""To convert non-decodable bytes, a new error handler ([2]) "surrogateescape" 
is introduced, which produces these surrogates. On encoding, the error handler 
converts the surrogate back to the corresponding byte. This error handler will 
be used in any API that receives or produces file names, command line 
arguments, or environment variables.

The error handler interface is extended to allow the encode error handler to 
return byte strings immediately, in addition to returning Unicode strings which 
then get encoded again (also see the discussion below)."""

----------
nosy: +doerwalter

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

Reply via email to