diff --git a/stdlib/@tests/stubtest_allowlists/py314.txt b/stdlib/@tests/stubtest_allowlists/py314.txt index aedbbcde0..bfbf9cd9f 100644 --- a/stdlib/@tests/stubtest_allowlists/py314.txt +++ b/stdlib/@tests/stubtest_allowlists/py314.txt @@ -364,8 +364,6 @@ dataclasses.Field.__init__ dataclasses.Field.doc dataclasses.field dataclasses.make_dataclass -datetime.date.strptime -datetime.time.strptime decimal.Decimal.from_number decimal.DecimalTuple.__annotate_func__ decimal.DecimalTuple.__annotations_cache__ diff --git a/stdlib/datetime.pyi b/stdlib/datetime.pyi index 72fb5fceb..37d6a06df 100644 --- a/stdlib/datetime.pyi +++ b/stdlib/datetime.pyi @@ -73,6 +73,11 @@ class date: @property def day(self) -> int: ... def ctime(self) -> str: ... + + if sys.version_info >= (3, 14): + @classmethod + def strptime(cls, date_string: str, format: str, /) -> Self: ... + # On <3.12, the name of the parameter in the pure-Python implementation # didn't match the name in the C implementation, # meaning it is only *safe* to pass it as a keyword argument on 3.12+ @@ -142,6 +147,11 @@ class time: def isoformat(self, timespec: str = ...) -> str: ... @classmethod def fromisoformat(cls, time_string: str, /) -> Self: ... + + if sys.version_info >= (3, 14): + @classmethod + def strptime(cls, date_string: str, format: str, /) -> Self: ... + # On <3.12, the name of the parameter in the pure-Python implementation # didn't match the name in the C implementation, # meaning it is only *safe* to pass it as a keyword argument on 3.12+