8000 Merge branch 'main' into 3.14-zstd-c-code · python/cpython@90b9172 · GitHub
[go: up one dir, main page]

Skip to content

Commit 90b9172

Browse files
authored
Merge branch 'main' into 3.14-zstd-c-code
2 parents 30b3934 + 881144f commit 90b9172

33 files changed

+257
-145
lines changed

Doc/library/cmdline.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ The following modules have a command-line interface.
2727
* :mod:`pdb`
2828
* :ref:`pickle <pickle-cli>`
2929
* :ref:`pickletools <pickletools-cli>`
30-
* :mod:`platform`
30+
* :ref:`platform <platform-cli>`
3131
* :mod:`poplib`
3232
* :ref:`profile <profile-cli>`
3333
* :mod:`pstats`

Doc/library/fnmatch.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ functions: :func:`fnmatch`, :func:`fnmatchcase`, :func:`.filter`.
111111
>>>
112112
>>> regex = fnmatch.translate('*.txt')
113113
>>> regex
114-
'(?s:.*\\.txt)\\Z'
114+
'(?s:.*\\.txt)\\z'
115115
>>> reobj = re.compile(regex)
116116
>>> reobj.match('foobar.txt')
117117
<re.Match object; span=(0, 10), match='foobar.txt'>

Doc/library/glob.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ The :mod:`glob` module defines the following functions:
134134
>>>
135135
>>> regex = glob.translate('**/*.txt', recursive=True, include_hidden=True)
136136
>>> regex
137-
'(?s:(?:.+/)?[^/]*\\.txt)\\Z'
137+
'(?s:(?:.+/)?[^/]*\\.txt)\\z'
138138
>>> reobj = re.compile(regex)
139139
>>> reobj.match('foo/bar/baz.txt')
140140
<re.Match object; span=(0, 15), match='foo/bar/baz.txt'>

Doc/library/platform.rst

Lines changed: 36 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
section.
1818

1919

20-
Cross Platform
20+
Cross platform
2121
--------------
2222

2323

@@ -188,7 +188,7 @@ Cross Platform
188188
:attr:`processor` is resolved late instead of immediately.
189189

190190

191-
Java Platform
191+
Java platform
192192
-------------
193193

194194

@@ -206,7 +206,7 @@ Java Platform
206206
and was only useful for Jython support.
207207

208208

209-
Windows Platform
209+
Windows platform
210210
----------------
211211

212212

@@ -240,7 +240,7 @@ Windows Platform
240240
.. versionadded:: 3.8
241241

242242

243-
macOS Platform
243+
macOS platform
244244
--------------
245245

246246
.. function:: mac_ver(release='', versioninfo=('','',''), machine='')
@@ -252,7 +252,7 @@ macOS Platform
252252
Entries which cannot be determined are set to ``''``. All tuple entries are
253253
strings.
254254

255-
iOS Platform
255+
iOS platform
256256
------------
257257

258258
.. function:: ios_ver(system='', release='', model='', is_simulator=False)
@@ -271,7 +271,7 @@ iOS Platform
271271
parameters.
272272

273273

274-
Unix Platforms
274+
Unix platforms
275275
--------------
276276

277277
.. function:: libc_ver(executable=sys.executable, lib='', version='', chunksize=16384)
@@ -287,7 +287,7 @@ Unix Platforms
287287
The file is read and scanned in chunks of *chunksize* bytes.
288288

289289

290-
Linux Platforms
290+
Linux platforms
291291
---------------
292292

293293
.. function:: freedesktop_os_release()
@@ -325,7 +325,7 @@ Linux Platforms
325325
.. versionadded:: 3.10
326326

327327

328-
Android Platform
328+
Android platform
329329
----------------
330330

331331
.. function:: android_ver(release="", api_level=0, manufacturer="", \
@@ -360,6 +360,34 @@ Android Platform
360360

361361
.. versionadded:: 3.13
362362

363+
.. _platform-cli:
364+
365+
Command-line usage
366+
------------------
367+
368+
:mod:`platform` can also be invoked directly using the :option:`-m`
369+
switch of the interpreter::
370+
371+
python -m platform [--terse] [--nonaliased] [{nonaliased,terse} ...]
372+
373+
The following options are accepted:
374+
375+
.. program:: platform
376+
377+
.. option:: --terse
378+
379+
Print terse information about the platform. This is equivalent to
380+
calling :func:`platform.platform` with the *terse* argument set to ``True``.
381+
382+
.. option:: --nonaliased
383+
384+
Print platform information without system/OS name aliasing. This is
385+
equivalent to calling :func:`platform.platform` with the *aliased* argument
386+
set to ``True``.
387+
388+
You can also pass one or more positional arguments (``terse``, ``nonaliased``)
389+
to explicitly control the output format. These behave similarly to their
390+
corresponding options.
363391

364392
Miscellaneous
365393
-------------

Doc/whatsnew/3.14.rst

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,12 @@ Summary -- release highlights
7171
* :ref:`PEP 761: Discontinuation of PGP signatures <whatsnew314-pep761>`
7272
* :ref:`PEP 765: Disallow return/break/continue that exit a finally block <whatsnew314-pep765>`
7373
* :ref:`PEP 768: Safe external debugger interface for CPython <whatsnew314-pep768>`
74-
* :ref:`A new type of interpreter <whatsnew314-tail-call>`
74+
* :ref:`A new type of interpreter <whatsnew314-tail-call>`
75+
* :ref:`Syntax highlighting in PyREPL <whatsnew314-pyrepl-highlighting>`,
76+
and color output in :ref:`unittest <whatsnew314-color-unittest>`,
77+
:ref:`argparse <whatsnew314-color-argparse>`,
78+
:ref:`json <whatsnew314-color-json>` and
79+
:ref:`calendar <whatsnew314-color-calendar>` CLIs
7580

7681

7782
Incompatible changes
@@ -560,6 +565,9 @@ For further information on how to build Python, see
560565
(Contributed by Ken Jin in :gh:`128563`, with ideas on how to implement this
561566
in CPython by Mark Shannon, Garrett Gu, Haoran Xu, and Josh Haberman.)
562567

568+
569+
.. _whatsnew314-pyrepl-highlighting:
570+
563571
Syntax highlighting in PyREPL
564572
-----------------------------
565573

@@ -703,6 +711,17 @@ argparse
703711
and subparser names if mistyped by the user.
704712
(Contributed by Savannah Ostrowski in :gh:`124456`.)
705713

714+
.. _whatsnew314-color-argparse:
715+
716+
* Introduced the optional *color* parameter to
717+
:class:`argparse.ArgumentParser`, enabling color for help text.
718+
This can be controlled via the :envvar:`PYTHON_COLORS` environment
719+
variable as well as the canonical |NO_COLOR|_
720+
and |FORCE_COLOR|_ environment variables.
721+
See also :ref:`using-on-controlling-color`.
722+
(Contributed by Hugo van Kemenade in :gh:`130645`.)
723+
724+
706725
ast
707726
---
708727

@@ -728,6 +747,9 @@ bdb
728747
* The :mod:`bdb` module now supports the :mod:`sys.monitoring` backend.
729748
(Contributed by Tian Gao in :gh:`124533`.)
730749

750+
751+
.. _whatsnew314-color-calendar:
752+
731753
calendar
732754
--------
733755

@@ -1026,6 +1048,8 @@ json
10261048
See the :ref:`JSON command-line interface <json-commandline>` documentation.
10271049
(Contributed by Trey Hunner in :gh:`122873`.)
10281050

1051+
.. _whatsnew314-color-json:
1052+
10291053
* By default, the output of the :ref:`JSON command-line interface <json-commandline>`
10301054
is highlighted in color. This can be controlled via the
10311055
:envvar:`PYTHON_COLORS` environment variable as well as the canonical
@@ -1472,6 +1496,8 @@ unicodedata
14721496
* The Unicode database has been updated to Unicode 16.0.0.
14731497

14741498

1499+
.. _whatsnew314-color-unittest:
1500+
14751501
unittest
14761502
--------
14771503

Lib/_py_warnings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,7 @@ def _setoption(arg):
371371
if message:
372372
message = re.escape(message)
373373
if module:
374-
module = re.escape(module) + r'\Z'
374+
module = re.escape(module) + r'\z'
375375
if lineno:
376376
try:
377377
lineno = int 10000 (lineno)

Lib/_pydecimal.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6096,7 +6096,7 @@ def _convert_for_comparison(self, other, equality_op=False):
60966096
(?P<diag>\d*) # with (possibly empty) diagnostic info.
60976097
)
60986098
# \s*
6099-
\Z
6099+
\z
61006100
""", re.VERBOSE | re.IGNORECASE).match
61016101

61026102
_all_zeros = re.compile('0*$').match
@@ -6124,7 +6124,7 @@ def _convert_for_comparison(self, other, equality_op=False):
61246124
(?P<thousands_sep>[,_])?
61256125
(?:\.(?P<precision>0|(?!0)\d+))?
61266126
(?P<type>[eEfFgGn%])?
6127-
\Z
6127+
\z
61286128
""", re.VERBOSE|re.DOTALL)
61296129

61306130
del re

Lib/email/feedparser.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030

3131
NLCRE = re.compile(r'\r\n|\r|\n')
3232
NLCRE_bol = re.compile(r'(\r\n|\r|\n)')
33-
NLCRE_eol = re.compile(r'(\r\n|\r|\n)\Z')
33+
NLCRE_eol = re.compile(r'(\r\n|\r|\n)\z')
3434
NLCRE_crack = re.compile(r'(\r\n|\r|\n)')
3535
# RFC 2822 $3.6.8 Optional fields. ftext is %d33-57 / %d59-126, Any character
3636
# except controls, SP, and ":".

Lib/fnmatch.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ def _translate(pat, star, question_mark):
185185

186186
def _join_translated_parts(parts, star_indices):
187187
if not star_indices:
188-
return fr'(?s:{"".join(parts)})\Z'
188+
return fr'(?s:{"".join(parts)})\z'
189189
iter_star_indices = iter(star_indices)
190190
j = next(iter_star_indices)
191191
buffer = parts[:j] # fixed pieces at the start
@@ -206,4 +206,4 @@ def _join_translated_parts(parts, star_indices):
206206
append('.*')
207207
extend(parts[i:])
208208
res = ''.join(buffer)
209-
return fr'(?s:{res})\Z'
209+
return fr'(?s:{res})\z'

Lib/fractions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ def _hash_algorithm(numerator, denominator):
6464
(?:\.(?P<decimal>\d*|\d+(_\d+)*))? # an optional fractional part
6565
(?:E(?P<exp>[-+]?\d+(_\d+)*))? # and optional exponent
6666
)
67-
\s*\Z # and optional whitespace to finish
67+
\s*\z # and optional whitespace to finish
6868
""", re.VERBOSE | re.IGNORECASE)
6969

7070

Lib/glob.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ def translate(pat, *, recursive=False, include_hidden=False, seps=None):
316316
if idx < last_part_idx:
317317
results.append(any_sep)
318318
res = ''.join(results)
319-
return fr'(?s:{res})\Z'
319+
return fr'(?s:{res})\z'
320320

321321

322322
@functools.lru_cache(maxsize=512)

Lib/idlelib/pyshell.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1350,7 +1350,7 @@ def recall(self, s, event):
13501350
self.text.see("insert")
13511351
self.text.undo_block_stop()
13521352

1353-
_last_newline_re = re.compile(r"[ \t]*(\n[ \t]*)?\Z")
1353+
_last_newline_re = re.compile(r"[ \t]*(\n[ \t]*)?\z")
13541354
def runit(self):
13551355
index_before = self.text.index("end-2c")
13561356
line = self.text.get("iomark", "end-1c")

Lib/test/test_asyncio/test_locks.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
r'(, value:\d)?'
1515
r'(, waiters:\d+)?'
1616
r'(, waiters:\d+\/\d+)?' # barrier
17-
r')\]>\Z'
17+
r')\]>\z'
1818
)
1919
RGX_REPR = re.compile(STR_RGX_REPR)
2020

Lib/test/test_capi/test_float.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -199,13 +199,13 @@ def test_pack_unpack_roundtrip_for_nans(self):
199199
signaling = 0
200200
quiet = int(not signaling)
201201
if size == 8:
202-
payload = random.randint(signaling, 1 << 50)
202+
payload = random.randint(signaling, 0x7ffffffffffff)
203203
i = (sign << 63) + (0x7ff << 52) + (quiet << 51) + payload
204204
elif size == 4:
205-
payload = random.randint(signaling, 1 << 21)
205+
payload = random.randint(signaling, 0x3fffff)
206206
i = (sign << 31) + (0xff << 23) + (quiet << 22) + payload
207207
elif size == 2:
208-
payload = random.randint(signaling, 1 << 8)
208+
payload = random.randint(signaling, 0x1ff)
209209
i = (sign << 15) + (0x1f << 10) + (quiet << 9) + payload
210210
data = bytes.fromhex(f'{i:x}')
211211
for endian in (BIG_ENDIAN, LITTLE_ENDIAN):

0 commit comments

Comments
 (0)
0