diff --git a/stdlib/@tests/stubtest_allowlists/py314.txt b/stdlib/@tests/stubtest_allowlists/py314.txt index 4f3c0f854..614a875c4 100644 --- a/stdlib/@tests/stubtest_allowlists/py314.txt +++ b/stdlib/@tests/stubtest_allowlists/py314.txt @@ -27,8 +27,6 @@ asyncio.tasks.eager_task_factory builtins.bytearray.resize builtins.classmethod.__annotate__ builtins.classmethod.__class_getitem__ -builtins.complex.from_number -builtins.float.from_number builtins.int.__round__ builtins.memoryview.__class_getitem__ builtins.staticmethod.__annotate__ @@ -56,7 +54,6 @@ enum.EnumType.__signature__ faulthandler.dump_c_stack fractions.Fraction.__pow__ fractions.Fraction.__rpow__ -fractions.Fraction.from_number gzip.GzipFile.readinto gzip.GzipFile.readinto1 gzip.compress diff --git a/stdlib/builtins.pyi b/stdlib/builtins.pyi index 8e1e02ac3..00728f42d 100644 --- a/stdlib/builtins.pyi +++ b/stdlib/builtins.pyi @@ -400,6 +400,9 @@ class float: def __abs__(self) -> float: ... def __hash__(self) -> int: ... def __bool__(self) -> bool: ... + if sys.version_info >= (3, 14): + @classmethod + def from_number(cls, number: float | SupportsIndex | SupportsFloat, /) -> Self: ... class complex: # Python doesn't currently accept SupportsComplex for the second argument @@ -435,6 +438,9 @@ class complex: def __bool__(self) -> bool: ... if sys.version_info >= (3, 11): def __complex__(self) -> complex: ... + if sys.version_info >= (3, 14): + @classmethod + def from_number(cls, number: complex | SupportsComplex | SupportsFloat | SupportsIndex, /) -> Self: ... class _FormatMapMapping(Protocol): def __getitem__(self, key: str, /) -> Any: ... diff --git a/stdlib/fractions.pyi b/stdlib/fractions.pyi index 4d5c2160e..83592eb58 100644 --- a/stdlib/fractions.pyi +++ b/stdlib/fractions.pyi @@ -145,3 +145,6 @@ class Fraction(Rational): @property def imag(self) -> Literal[0]: ... def conjugate(self) -> Fraction: ... + if sys.version_info >= (3, 14): + @classmethod + def from_number(cls, number: float | Rational | _ConvertibleToIntegerRatio) -> Self: ...