From ad7bf13f4b9a263456eb5b1f9d93fd436f3ccc5e Mon Sep 17 00:00:00 2001 From: Huanyi Xie <74809554+xiehuanyi@users.noreply.github.com> Date: Tue, 13 Oct 2026 21:29:54 +0300 Subject: [PATCH] Preserve the iterator return type of TopologicalSorter.static_order --- stdlib/graphlib.pyi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/stdlib/graphlib.pyi b/stdlib/graphlib.pyi index f0ac72b6135e..0e77f031ad1c 100644 --- a/stdlib/graphlib.pyi +++ b/stdlib/graphlib.pyi @@ -1,6 +1,6 @@ import sys from _typeshed import SupportsItems -from collections.abc import Iterable +from collections.abc import Iterable, Iterator from typing import Any, Generic, TypeVar, overload __all__ = ["TopologicalSorter", "CycleError"] @@ -22,7 +22,7 @@ class TopologicalSorter(Generic[_T]): def __bool__(self) -> bool: ... def done(self, *nodes: _T) -> None: ... def get_ready(self) -> tuple[_T, ...]: ... - def static_order(self) -> Iterable[_T]: ... + def static_order(self) -> Iterator[_T]: ... if sys.version_info >= (3, 11): def __class_getitem__(cls, item: Any, /) -> GenericAlias: ...