This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients Arfrever, hynek, serhiy.storchaka, tarek, vstinner
Date 2013-06-23.11:42:32
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1371987752.39.0.670359506629.issue18283@psf.upfronthosting.co.za>
In-reply-to
Content
"What about bytearrays and other byte-like objects?

However I'm not sure this enhancement is worth to be accepted. Many other high-level functions in os and shutil modules do not support bytes paths. For shutil.which() there is no backward compatibility with Python 2 which we should support."

Bytes is the native type for path on all platforms... except Windows. So I fixed many functions of the os module to support bytes parameters. For example, functions of os.path support str and bytes types, but not bytearray. I also prefer to reject byte-like objects, to keep it simple.

The bytes type should be accepted for any kind of os function parameter: path, environment variable, command line argument, etc. It's not a question of being compatible with Python 2, an application can make the choice of only used bytes because bytes is the native type for OS data on UNIX.

Python 3 supports also "bytes stored in Unicode" thanks to the PEP 393, but it's not exactly the same: a path stored as str depends on the filesystem locale, whereas a bytes string is well defined (it's just an array of 8-bit unsigned numbers) and doesn't depend on any configuration variable.
History
Date User Action Args
2013-06-23 11:42:32vstinnersetrecipients: + vstinner, tarek, Arfrever, hynek, serhiy.storchaka
2013-06-23 11:42:32vstinnersetmessageid: <1371987752.39.0.670359506629.issue18283@psf.upfronthosting.co.za>
2013-06-23 11:42:32vstinnerlinkissue18283 messages
2013-06-23 11:42:32vstinnercreate