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 arigo
Recipients arigo
Date 2017-07-08.16:27:45
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1499531265.54.0.318966689253.issue30879@psf.upfronthosting.co.za>
In-reply-to
Content
The ``os`` functions generally accept any buffer-supporting object as file names, and interpret it as if ``bytes()`` had been called on it.  However, ``os.listdir(x)`` uses the type of ``x`` to know if it should return a list of bytes or a list of unicodes---and the condition seems to be ``isinstance(x, bytes)``.  So we get this kind of inconsistent behaviour:

>>> os.listdir(b".")
[b'python', b'Include', b'python-config.py', ...]

>>> os.listdir(bytearray(b"."))
['python', 'Include', 'python-config.py', ...]
History
Date User Action Args
2017-07-08 16:27:45arigosetrecipients: + arigo
2017-07-08 16:27:45arigosetmessageid: <1499531265.54.0.318966689253.issue30879@psf.upfronthosting.co.za>
2017-07-08 16:27:45arigolinkissue30879 messages
2017-07-08 16:27:45arigocreate