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 <>
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'', ...]

>>> os.listdir(bytearray(b"."))
['python', 'Include', '', ...]
Date User Action Args
2017-07-08 16:27:45arigosetrecipients: + arigo
2017-07-08 16:27:45arigosetmessageid: <>
2017-07-08 16:27:45arigolinkissue30879 messages
2017-07-08 16:27:45arigocreate