Skip to content

Commit a631519

Browse files
committed
Add Python 3.15 calendar datetime and difflib updates
1 parent a7912d5 commit a631519

4 files changed

Lines changed: 45 additions & 26 deletions

File tree

stdlib/@tests/stubtest_allowlists/py315.txt

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -118,10 +118,6 @@ binascii.b2a_base64
118118
binascii.b2a_base85
119119
binascii.unhexlify
120120
cProfile.label
121-
calendar.HTMLCalendar.formatmonthpage
122-
calendar.__all__
123-
calendar.standalone_month_abbr
124-
calendar.standalone_month_name
125121
codecs.backslashreplace_errors
126122
codecs.ignore_errors
127123
codecs.namereplace_errors
@@ -146,16 +142,9 @@ ctypes.SetPointerType
146142
dataclasses._MISSING_TYPE
147143
dataclasses.MISSING
148144
dataclasses.field
149-
datetime.date.fromisoformat
150-
datetime.date.strptime
151-
datetime.datetime.fromisoformat
152-
datetime.datetime.strptime
153-
datetime.time.fromisoformat
154-
datetime.time.strptime
155145
dbm.dumb._Database.reorganize
156146
dbm.sqlite3.REORGANIZE
157147
dbm.sqlite3._Database.reorganize
158-
difflib.unified_diff
159148
doctest.DocTestRunner.report_skip
160149
enum.__all__
161150
enum.auto.__init__

stdlib/calendar.pyi

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ if sys.version_info >= (3, 12):
5757
"NOVEMBER",
5858
"DECEMBER",
5959
]
60+
if sys.version_info >= (3, 15):
61+
__all__ += ["standalone_month_name", "standalone_month_abbr"]
6062

6163
_LocaleType: TypeAlias = tuple[str | None, str | None]
6264

@@ -127,6 +129,11 @@ class HTMLCalendar(Calendar):
127129
def formatweekheader(self) -> str: ...
128130
def formatmonthname(self, theyear: int, themonth: int, withyear: bool = True) -> str: ...
129131
def formatmonth(self, theyear: int, themonth: int, withyear: bool = True) -> str: ...
132+
if sys.version_info >= (3, 15):
133+
def formatmonthpage(
134+
self, theyear: int, themonth: int, width: int = 3, css: str | None = "calendar.css", encoding: str | None = None
135+
) -> bytes: ...
136+
130137
def formatyear(self, theyear: int, width: int = 3) -> str: ...
131138
def formatyearpage(
132139
self, theyear: int, width: int = 3, css: str | None = "calendar.css", encoding: str | None = None
@@ -212,3 +219,7 @@ else:
212219
SUNDAY: Final = 6
213220

214221
EPOCH: Final = 1970
222+
223+
if sys.version_info >= (3, 15):
224+
standalone_month_name: Sequence[str]
225+
standalone_month_abbr: Sequence[str]

stdlib/datetime.pyi

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ class date:
6464
@classmethod
6565
def fromordinal(cls, n: int, /) -> Self: ...
6666
@classmethod
67-
def fromisoformat(cls, date_string: str, /) -> Self: ...
67+
def fromisoformat(cls, string: str, /) -> Self: ...
6868
@classmethod
6969
def fromisocalendar(cls, year: int, week: int, day: int) -> Self: ...
7070
@property
@@ -77,7 +77,7 @@ class date:
7777

7878
if sys.version_info >= (3, 14):
7979
@classmethod
80-
def strptime(cls, date_string: str, format: str, /) -> Self: ...
80+
def strptime(cls, string: str, format: str, /) -> Self: ...
8181

8282
# On <3.12, the name of the parameter in the pure-Python implementation
8383
# didn't match the name in the C implementation,
@@ -148,11 +148,11 @@ class time:
148148
def __hash__(self) -> int: ...
149149
def isoformat(self, timespec: str = "auto") -> str: ...
150150
@classmethod
151-
def fromisoformat(cls, time_string: str, /) -> Self: ...
151+
def fromisoformat(cls, string: str, /) -> Self: ...
152152

153153
if sys.version_info >= (3, 14):
154154
@classmethod
155-
def strptime(cls, date_string: str, format: str, /) -> Self: ...
155+
def strptime(cls, string: str, format: str, /) -> Self: ...
156156

157157
# On <3.12, the name of the parameter in the pure-Python implementation
158158
# didn't match the name in the C implementation,
@@ -291,6 +291,8 @@ class datetime(date):
291291
def utcnow(cls) -> Self: ...
292292
@classmethod
293293
def combine(cls, date: _Date, time: _Time, tzinfo: _TzInfo | None = ...) -> Self: ...
294+
@classmethod
295+
def fromisoformat(cls, string: str, /) -> Self: ...
294296
def timestamp(self) -> float: ...
295297
def utctimetuple(self) -> struct_time: ...
296298
def date(self) -> _Date: ...
@@ -328,7 +330,7 @@ class datetime(date):
328330
def astimezone(self, tz: _TzInfo | None = None) -> Self: ...
329331
def isoformat(self, sep: str = "T", timespec: str = "auto") -> str: ...
330332
@classmethod
331-
def strptime(cls, date_string: str, format: str, /) -> Self: ...
333+
def strptime(cls, string: str, format: str, /) -> Self: ...
332334
def utcoffset(self) -> timedelta | None: ...
333335
def tzname(self) -> str | None: ...
334336
def dst(self) -> timedelta | None: ...

stdlib/difflib.pyi

Lines changed: 27 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -69,16 +69,33 @@ else:
6969
def IS_LINE_JUNK(line: str, pat: Callable[[str], re.Match[str] | None] = ...) -> bool: ...
7070

7171
def IS_CHARACTER_JUNK(ch: str, ws: str = " \t") -> bool: ... # ws is undocumented
72-
def unified_diff(
73-
a: Sequence[str],
74-
b: Sequence[str],
75-
fromfile: str = "",
76-
tofile: str = "",
77-
fromfiledate: str = "",
78-
tofiledate: str = "",
79-
n: int = 3,
80-
lineterm: str = "\n",
81-
) -> Iterator[str]: ...
72+
73+
if sys.version_info >= (3, 15):
74+
def unified_diff(
75+
a: Sequence[str],
76+
b: Sequence[str],
77+
fromfile: str = "",
78+
tofile: str = "",
79+
fromfiledate: str = "",
80+
tofiledate: str = "",
81+
n: int = 3,
82+
lineterm: str = "\n",
83+
*,
84+
color: bool = False,
85+
) -> Iterator[str]: ...
86+
87+
else:
88+
def unified_diff(
89+
a: Sequence[str],
90+
b: Sequence[str],
91+
fromfile: str = "",
92+
tofile: str = "",
93+
fromfiledate: str = "",
94+
tofiledate: str = "",
95+
n: int = 3,
96+
lineterm: str = "\n",
97+
) -> Iterator[str]: ...
98+
8299
def context_diff(
83100
a: Sequence[str],
84101
b: Sequence[str],

0 commit comments

Comments
 (0)