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 Jonas Thiem, The Compiler, r.david.murray
Date 2015-11-06.13:58:12
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1446818292.72.0.196327303662.issue25567@psf.upfronthosting.co.za>
In-reply-to
Content
I think that this is a reasonable request, and probably applies to the whole shlex module, although less strongly.

You could use the surrogateescape hack to work around the problem:

  shlex.quote(mydata.encode('ascii', 'surrogateescape')).decode('ascii', 'surrogateescape)

That might be the only practical way to handle bytes input to the shlex parser, if we do also want to tackle that.

Note that it is already the case that os module functions that retrn filenames and stdin/stdout use surrogateescape, so a naive program may actually work with binary filenames (which is why the handler is used in those contexts).
History
Date User Action Args
2015-11-06 13:58:12r.david.murraysetrecipients: + r.david.murray, The Compiler, Jonas Thiem
2015-11-06 13:58:12r.david.murraysetmessageid: <1446818292.72.0.196327303662.issue25567@psf.upfronthosting.co.za>
2015-11-06 13:58:12r.david.murraylinkissue25567 messages
2015-11-06 13:58:12r.david.murraycreate