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.
Created on 2016年06月02日 17:30 by ethan.furman, last changed 2022年04月11日 14:58 by admin. This issue is now closed.
| Messages (8) | |||
|---|---|---|---|
| msg267019 - (view) | Author: Eryk Sun (eryksun) * (Python triager) | Date: 2016年06月03日 01:36 | |
nt is the module name for posixmodule.c on Windows, so I'm changing the title to reference ntpath instead. Regarding nt, two of its built-in functions are exposed directly in ntpath. _isdir is imported as isdir, so it needs a wrapper to support __fspath__. Only pathlib uses _getfinalpathname, so for now I think it can be handled there. There's also nt._getdiskusage, which is only used by shutil.disk_usage. For some reason the PEP doesn't mention updating shutil to support __fspath__. |
|||
| msg267039 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) | Date: 2016年06月03日 05:00 | |
Please don't change os.path until all other module will be changed. It may be that os.path would not need any change at all. |
|||
| msg267047 - (view) | Author: Eryk Sun (eryksun) * (Python triager) | Date: 2016年06月03日 05:43 | |
Sorry, I must have missed or misunderstood something. PEP 519 discusses modifying os.path. For the os module it only discusses adding fspath and updating fsencode and fsdecode. It also discusses a new PyOS_FSPath C API, but without any discussion regarding its use in the implementation of the posix / nt module, or regarding what built-in os functions should support __fspath__. |
|||
| msg267104 - (view) | Author: Ethan Furman (ethan.furman) * (Python committer) | Date: 2016年06月03日 14:58 | |
@Serhy: Isn't that backwards? I would think that by doing os.path first most other libraries would not have to change. |
|||
| msg267138 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) | Date: 2016年06月03日 19:08 | |
I think that if some high-level function uses os.path, it likely should convert Path argument to str either because the path should be saved as a string, or for performance if multiple os.path functions are called with the same argument. Note, that some os.path functions will implicitly support path objects if the posix module support it. Let first find the functions that need path objects support in os.path. |
|||
| msg267144 - (view) | Author: Ethan Furman (ethan.furman) * (Python committer) | Date: 2016年06月03日 19:22 | |
The expected scenario, and the purpose of os.fspath(), is to enable high-level libraries to not know or care if they receive a pathlib object or a string. In other words, they already have os.path.join() and os.path.split() calls, and currently break noisily if a pathlib.Path is passed in; by enhancing os.path to accept a pathlib.Path object that high-level library can start working with pathlib.Path objects without changing a thing, which means the user of that library can use pathlib.Path painlessly. Unless I have seriously misunderstood something, os.path will be changed to work with __fspath__ objects. |
|||
| msg267163 - (view) | Author: Brett Cannon (brett.cannon) * (Python committer) | Date: 2016年06月03日 21:07 | |
os.path will be updated to work with __fspath__() as specified by Guido as part of the conversation for PEP 519 (IOW listing os.path as being updated in PEP 519 is not an accident). |
|||
| msg272053 - (view) | Author: Brett Cannon (brett.cannon) * (Python committer) | Date: 2016年08月05日 19:44 | |
I added support for ntpath as part of issue #27524. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:58:31 | admin | set | github: 71371 |
| 2016年08月05日 19:44:45 | brett.cannon | set | status: open -> closed superseder: Update os.path for PEP 519/__fspath__() resolution: duplicate messages: + msg272053 |
| 2016年07月15日 21:06:56 | brett.cannon | link | issue27524 dependencies |
| 2016年06月03日 21:07:49 | brett.cannon | set | messages: + msg267163 |
| 2016年06月03日 19:22:27 | ethan.furman | set | messages: + msg267144 |
| 2016年06月03日 19:08:32 | serhiy.storchaka | set | messages: + msg267138 |
| 2016年06月03日 14:58:56 | ethan.furman | set | messages: + msg267104 |
| 2016年06月03日 05:43:10 | eryksun | set | messages: + msg267047 |
| 2016年06月03日 05:00:27 | serhiy.storchaka | set | messages: + msg267039 |
| 2016年06月03日 01:36:08 | eryksun | set | title: Support path objects in the nt module -> Support path objects in the ntpath module nosy: + eryksun, paul.moore, tim.golden, zach.ware, steve.dower messages: + msg267019 components: + Library (Lib), Windows |
| 2016年06月02日 17:40:21 | ethan.furman | set | type: behavior -> enhancement |
| 2016年06月02日 17:38:54 | ethan.furman | link | issue27182 dependencies |
| 2016年06月02日 17:30:06 | ethan.furman | create | |