From aeb9aa334927f20c0145c3ca7c3a1a3874592df6 Mon Sep 17 00:00:00 2001 From: Sebastian Rittau Date: Thu, 21 Aug 2025 16:02:04 +0200 Subject: [PATCH] Remove type alias _CallableElement in ElementTree (#14476) Remove _CallableElement and make _ElementCallable recursive --- stdlib/xml/etree/ElementTree.pyi | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/stdlib/xml/etree/ElementTree.pyi b/stdlib/xml/etree/ElementTree.pyi index 15826bafb..ff41c5dc6 100644 --- a/stdlib/xml/etree/ElementTree.pyi +++ b/stdlib/xml/etree/ElementTree.pyi @@ -80,7 +80,6 @@ def canonicalize( # The tag for Element can be set to the Comment or ProcessingInstruction # functions defined in this module. _ElementCallable: TypeAlias = Callable[..., Element[_ElementCallable]] -_CallableElement: TypeAlias = Element[_ElementCallable] _Tag = TypeVar("_Tag", default=str, bound=str | _ElementCallable) _OtherTag = TypeVar("_OtherTag", default=str, bound=str | _ElementCallable) @@ -137,8 +136,8 @@ class Element(Generic[_Tag]): def __bool__(self) -> bool: ... def SubElement(parent: Element, tag: str, attrib: dict[str, str] = ..., **extra: str) -> Element: ... -def Comment(text: str | None = None) -> _CallableElement: ... -def ProcessingInstruction(target: str, text: str | None = None) -> _CallableElement: ... +def Comment(text: str | None = None) -> Element[_ElementCallable]: ... +def ProcessingInstruction(target: str, text: str | None = None) -> Element[_ElementCallable]: ... PI = ProcessingInstruction