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 r.david.murray
Recipients abacabadabacaba, r.david.murray, serhiy.storchaka, vstinner
Date 2016-05-23.16:58:21
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1464022701.9.0.712233728326.issue27085@psf.upfronthosting.co.za>
In-reply-to
Content
The issue of passing an fd is a fair point.

However, converting the filenames to bytes isn't going to help you print them, you'll just get decoding errors when converting them to strings instead of encoding errors.  You could use the surrogateescape error handler on stdout via PYTHONIONENCODING if you want to get the bytes out, but in that case you don't need to encode them to bytes yourself, your program can just handle them as strings and let the python IO machinery deal with the bytes.

If you really want bytes filenames from listdir with an fd, you can just apply os.fsencode to the results:  map(os.fsencode, listdir(fd))

So, I'm still -1 on this proposal.

(Note: there is an existing open issue about surrogateescape and subprocess binary streams, so that is a known problem we haven't solved yet, and represents a more general problem than this issue.)
History
Date User Action Args
2016-05-23 16:58:22r.david.murraysetrecipients: + r.david.murray, vstinner, abacabadabacaba, serhiy.storchaka
2016-05-23 16:58:21r.david.murraysetmessageid: <1464022701.9.0.712233728326.issue27085@psf.upfronthosting.co.za>
2016-05-23 16:58:21r.david.murraylinkissue27085 messages
2016-05-23 16:58:21r.david.murraycreate