diff --git a/stdlib/@tests/test_cases/builtins/check_frozendict-py315.py b/stdlib/@tests/test_cases/builtins/check_frozendict-py315.py new file mode 100644 index 000000000000..dd222a4c796f --- /dev/null +++ b/stdlib/@tests/test_cases/builtins/check_frozendict-py315.py @@ -0,0 +1,15 @@ +from __future__ import annotations + +import sys +from typing import Any +from typing_extensions import assert_type + +if sys.version_info >= (3, 15): + # Regression test for gh-15985: ``frozendict`` can be constructed from + # keyword arguments, a mapping, or an iterable of pairs (not just with no + # arguments). + assert_type(frozendict(), frozendict[Any, Any]) + assert_type(frozendict(a=1), frozendict[str, int]) + assert_type(frozendict({"x": 1}), frozendict[str, int]) + assert_type(frozendict([("k", 2)]), frozendict[str, int]) + assert_type(frozendict({"x": 1}, y=2), frozendict[str, int]) diff --git a/stdlib/builtins.pyi b/stdlib/builtins.pyi index fdd554c7fcd7..096d440ac38c 100644 --- a/stdlib/builtins.pyi +++ b/stdlib/builtins.pyi @@ -1389,7 +1389,6 @@ if sys.version_info >= (3, 15): cls: type[frozendict[str, _VT]], iterable: Iterable[tuple[str, _VT]], /, **kwargs: _VT ) -> frozendict[str, _VT]: ... - def __init__(self) -> None: ... def copy(self) -> frozendict[_KT, _VT]: ... @overload