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

Ethan Furman ethan at stoneleaf.us
Wed Apr 13 11:28:28 EDT 2016

On 04/13/2016 08:17 AM, Random832 wrote:
> On Wed, Apr 13, 2016, at 10:21, Nick Coghlan wrote:

>> I'd expect the main consumers to be os and os.path, and would honestly
>> be surprised if we needed many explicit invocations above that layer,
>> other than in pathlib itself.
> I made a toy implementation to try this out, and making os.open support
> it does not get you builtin open "for free" as I had suspected; builtin
> open has its own type checks in _iomodule.c.

Yup, it will take some effort to make this work.

> Probably anything not implemented in pure python that deals with
> filenames is going to have to have its type checking revised.


You can see why there was no point in pursuing the conversation unless 
someone was willing to do the work.


More information about the Python-Dev mailing list