From fdfa8eada004f5f16b410949eda68bd54fb86fb3 Mon Sep 17 00:00:00 2001 From: Vladimir Babin Date: Mon, 16 Nov 2026 23:00:22 +0800 Subject: [PATCH] Widen fromstringlist sequence param to Iterable The runtime only iterates over the argument, so a generator or any other iterable works. Fixes #16839. --- stdlib/xml/etree/ElementTree.pyi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/stdlib/xml/etree/ElementTree.pyi b/stdlib/xml/etree/ElementTree.pyi index c77af2cb4dd1..87003bbbc852 100644 --- a/stdlib/xml/etree/ElementTree.pyi +++ b/stdlib/xml/etree/ElementTree.pyi @@ -1,7 +1,7 @@ import sys from _collections_abc import dict_keys from _typeshed import FileDescriptorOrPath, ReadableBuffer, SupportsRead, SupportsWrite -from collections.abc import Callable, Generator, ItemsView, Iterable, Iterator, Mapping, Sequence +from collections.abc import Callable, Generator, ItemsView, Iterable, Iterator, Mapping from typing import Any, Final, Generic, Literal, Protocol, SupportsIndex, TypeAlias, TypeGuard, TypeVar, overload, type_check_only from typing_extensions import deprecated, disjoint_base from xml.parsers.expat import XMLParserType @@ -310,7 +310,7 @@ def XMLID(text: str | ReadableBuffer, parser: XMLParser | None = None) -> tuple[ # This is aliased to XML in the source. fromstring = XML -def fromstringlist(sequence: Sequence[str | ReadableBuffer], parser: XMLParser | None = None) -> Element: ... +def fromstringlist(sequence: Iterable[str | ReadableBuffer], parser: XMLParser | None = None) -> Element: ... # This type is both not precise enough and too precise. The TreeBuilder # requires the elementfactory to accept tag and attrs in its args and produce