diff --git a/stdlib/marshal.pyi b/stdlib/marshal.pyi index 04cdf05b1934..4c4edaaa9072 100644 --- a/stdlib/marshal.pyi +++ b/stdlib/marshal.pyi @@ -1,3 +1,4 @@ +import builtins import sys import types from _typeshed import ReadableBuffer, SupportsRead, SupportsWrite @@ -5,6 +6,11 @@ from typing import Any, Final, TypeAlias version: Final[int] +if sys.version_info >= (3, 15): + _MarshallableMapping: TypeAlias = dict[Any, Any] | builtins.frozendict[Any, Any] +else: + _MarshallableMapping: TypeAlias = dict[Any, Any] + _Marshallable: TypeAlias = ( # handled in w_complex_object() in marshal.c int @@ -14,7 +20,7 @@ _Marshallable: TypeAlias = ( | str | tuple[_Marshallable, ...] | list[Any] - | dict[Any, Any] + | _MarshallableMapping | set[Any] | frozenset[_Marshallable] | types.CodeType diff --git a/stdlib/xml/etree/ElementTree.pyi b/stdlib/xml/etree/ElementTree.pyi index 87003bbbc852..eac80f8e2ee9 100644 --- a/stdlib/xml/etree/ElementTree.pyi +++ b/stdlib/xml/etree/ElementTree.pyi @@ -1,3 +1,4 @@ +import builtins import sys from _collections_abc import dict_keys from _typeshed import FileDescriptorOrPath, ReadableBuffer, SupportsRead, SupportsWrite @@ -92,7 +93,11 @@ class Element(Generic[_Tag]): attrib: dict[str, str] text: str | None tail: str | None - def __init__(self, tag: _Tag, attrib: dict[str, str] = {}, **extra: str) -> None: ... + if sys.version_info >= (3, 15): + def __init__(self, tag: _Tag, attrib: dict[str, str] | builtins.frozendict[str, str] = {}, **extra: str) -> None: ... + else: + def __init__(self, tag: _Tag, attrib: dict[str, str] = {}, **extra: str) -> None: ... + def append(self, subelement: Element[Any], /) -> None: ... def clear(self) -> None: ... def extend(self, elements: Iterable[Element[Any]], /) -> None: ...