[issue30247] Make importlib.machinery class handle os.PathLike path

2017-05-04 Thread Nick Coghlan
Nick Coghlan added the comment: FileFinder only handles a single directory, and FileLoader only handles a single file, so their "path" attributes are paths in the "fspath" sense, rather than the "sys.path" or "PathFinder" sense. Perhaps it would be worth the hassle of migrating to "fspath" as

[issue30247] Make importlib.machinery class handle os.PathLike path

2017-05-04 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: If the path attribute can be None or list it looks to me that it isn't a filesystem path, and it may be incorrect to use os.fspath() with it. How this attribute is used? What wrong if left it a pathlib.Path? -- __

[issue30247] Make importlib.machinery class handle os.PathLike path

2017-05-03 Thread Brett Cannon
Brett Cannon added the comment: The classes mentioned actually require that the path exist on the file system so there's no extra restrictions. As for cost, it's pretty cheap as a call to _os.fspath() is written in C and does an immediate type-check for str or bytes for the common-case (https

[issue30247] Make importlib.machinery class handle os.PathLike path

2017-05-03 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: I'm not sure it's a good idea. FileLoader, FileFinder, and other classes usually are a part of import machinery, they can have other restrictions on path type than general filesystem related functions. This change has a non-zero cost, it complicates the code

[issue30247] Make importlib.machinery class handle os.PathLike path

2017-05-03 Thread Louie Lu
Changes by Louie Lu : -- pull_requests: +1528 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.pyth

[issue30247] Make importlib.machinery class handle os.PathLike path

2017-05-03 Thread Louie Lu
Changes by Louie Lu : -- components: +Library (Lib) nosy: +brett.cannon ___ Python tracker ___ ___ Python-bugs-list mailing list Unsub

[issue30247] Make importlib.machinery class handle os.PathLike path

2017-05-03 Thread Louie Lu
Louie Lu added the comment: Relate to #29448 -- ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.py

[issue30247] Make importlib.machinery class handle os.PathLike path

2017-05-03 Thread Louie Lu
New submission from Louie Lu: Several importlib.machinery class has 'path' attribute, make it possible to handle os.PathLike. -- messages: 292856 nosy: louielu priority: normal severity: normal status: open title: Make importlib.machinery class handle os.PathLike path versions: Python 3