[issue9580] os.confstr() doesn't decode result according to PEP 383

David Watson report at bugs.python.org
Thu Aug 19 20:48:23 CEST 2010


David Watson <baikie at users.sourceforge.net> added the comment:

I wrote this patch to make confstr() return bytes (with code
similar to 2.x), and document the change in "Porting to Python
3.2" and elsewhere, but it then occurred to me that you might
have been talking about making a separate bytes API like
os.environb.  Which did you have in mind?

There is another option for a str API, which is to decode the
value as ASCII with the surrogateescape error handler.  The
returned string will then round-trip correctly through
PyUnicode_FSConverter(), etc., as long as the file system
encoding is compatible with ASCII, which PEP 383 requires it to
be.  This is how undecodable command line arguments are currently
handled when mbrtowc() is unavailable.

----------
Added file: http://bugs.python.org/file18582/confstr-bytes-3.2.diff

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue9580>
_______________________________________


More information about the Python-bugs-list mailing list