From c0fed911d64e483e89dc2190aad057f93fc431d3 Mon Sep 17 00:00:00 2001 From: Dmitriy Vashurin Date: Thu, 28 Aug 2025 22:26:46 +0700 Subject: [PATCH] Fix `ipaddress._BaseNetwork.hosts` return type (#14658) Both `IPv4Network` and `IPv6Network` can return a single-element list instead of iterator. --- stdlib/ipaddress.pyi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stdlib/ipaddress.pyi b/stdlib/ipaddress.pyi index d09804cb9..e2f3defa2 100644 --- a/stdlib/ipaddress.pyi +++ b/stdlib/ipaddress.pyi @@ -73,7 +73,7 @@ class _BaseNetwork(_IPAddressBase, Generic[_A]): @property def broadcast_address(self) -> _A: ... def compare_networks(self, other: Self) -> int: ... - def hosts(self) -> Iterator[_A]: ... + def hosts(self) -> Iterator[_A] | list[_A]: ... @property def is_global(self) -> bool: ... @property