-
- Notifications
You must be signed in to change notification settings - Fork 33.1k
Closed
Labels
3.11only security fixesonly security fixes3.12only security fixesonly security fixesstdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Description
Bug report
Python 3.11b1 raises with the following given path.rglob("")
where path
is a pathlib.Path
. This worked in previous versions (and also in whichever previous alphas GitHub Actions used).
def rglob(self, pattern): """Recursively yield all existing files (of any kind, including directories) matching the given relative pattern, anywhere in this subtree. """ sys.audit("pathlib.Path.rglob", self, pattern) drv, root, pattern_parts = self._flavour.parse_parts((pattern,)) if drv or root: raise NotImplementedError("Non-relative patterns are unsupported") > if pattern[-1] in (self._flavour.sep, self._flavour.altsep): E IndexError: string index out of range
rglob
is documented as
This is like calling Path.glob() with “**/” added in front of the given relative pattern
so I think ""
is a valid input to rglob()
.
Pretty sure this was introduced in ea2f5bc/#10349.
Your environment
- CPython versions tested on: 3.11b1
- Operating system and architecture: Both Linux and Windows.
Cross-ref: pytest-dev/pytest#9930
Metadata
Metadata
Assignees
Labels
3.11only security fixesonly security fixes3.12only security fixesonly security fixesstdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error