From 795336d3e9edaad37955b92690cb935a418977ff Mon Sep 17 00:00:00 2001 From: Colin Watson Date: Sun, 8 Dec 2024 14:47:23 +0000 Subject: [PATCH] Weaken return type of Path.{glob,rglob} in 3.13 Since https://github.com/python/cpython/pull/117589 (at least), `Path.glob` and `Path.rglob` return an `Iterator` rather than a `Generator`. --- stdlib/pathlib.pyi | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/stdlib/pathlib.pyi b/stdlib/pathlib.pyi index bdca375f626d..e2a816ae1ca4 100644 --- a/stdlib/pathlib.pyi +++ b/stdlib/pathlib.pyi @@ -129,12 +129,10 @@ class Path(PurePath): def read_text(self, encoding: str | None = None, errors: str | None = None) -> str: ... if sys.version_info >= (3, 13): - def glob( - self, pattern: str, *, case_sensitive: bool | None = None, recurse_symlinks: bool = False - ) -> Generator[Self, None, None]: ... + def glob(self, pattern: str, *, case_sensitive: bool | None = None, recurse_symlinks: bool = False) -> Iterator[Self]: ... def rglob( self, pattern: str, *, case_sensitive: bool | None = None, recurse_symlinks: bool = False - ) -> Generator[Self, None, None]: ... + ) -> Iterator[Self]: ... elif sys.version_info >= (3, 12): def glob(self, pattern: str, *, case_sensitive: bool | None = None) -> Generator[Self, None, None]: ... def rglob(self, pattern: str, *, case_sensitive: bool | None = None) -> Generator[Self, None, None]: ...