[Python-Dev] Pathlib enhancements - acceptable inputs and outputs for fspath and os.fspath() (original) (raw)

Paul Moore p.f.moore at gmail.com
Wed Apr 13 10:11:13 EDT 2016


On 13 April 2016 at 14:51, Nick Coghlan <ncoghlan at gmail.com> wrote:

The potentially SE-strings only come back when you pass str, and the operating system data isn't properly encoded according to the nominal filesystem encoding. They round trip nicely to other operating system APIs, but can indeed be a problem if they escape to other parts of your program

If the operating system APIs handle SE-strings correctly, is it not acceptable to require the fspath protocol to return strings, and then places like DirEntry or Ethan's module, when they want to return bytes, can just SE-encode the bytes and return those?

Or will the fspath protocol be used at a low enough level that it's below the point where SE-encoded strings are handled properly?

Paul



More information about the Python-Dev mailing list