GH-125413: Add `pathlib.Path.info` attribute by barneygale · Pull Request #127730 · python/cpython
When a path object is generated by `PathBase.iterdir()`, then its `_info` attribute now stores a `os.DirEntry`-like object that can be used to query the file type. This removes any need for a `_scandir()` method. Currently the `_info` attribute is private and only guaranteed to be populated in paths from `iterdir()`. Later on, I'm hoping to rename it to `info` and ensure that it's populated for all kinds of paths (this probably involves adding a `pathlib.FileInfo` class.) In the pathlib ABCs, `info` will replace `stat()` as the lowest-level abstract file status querying mechanism.
barneygale
changed the title
GH-125413: pathlib ABCs: replace
GH-125413: pathlib ABCs: replace _scandir() with _info_scandir() with _status
barneygale
changed the title
GH-125413: pathlib ABCs: replace
GH-125413: Add _scandir() with _statuspathlib.Path.status attribute
barneygale
changed the title
GH-125413: Add
GH-125413: Add pathlib.Path.status attributepathlib.Path.info attribute
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters