Skip to content

Commit b881215

Browse files
committed
Merge remote-tracking branch 'upstream/main' into repl-highlight
2 parents 131a08f + 2a54acf commit b881215

42 files changed

Lines changed: 631 additions & 226 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.pre-commit-config.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ repos:
1414
name: Run Ruff (lint) on Tools/build/
1515
args: [--exit-non-zero-on-fix, --config=Tools/build/.ruff.toml]
1616
files: ^Tools/build/
17+
- id: ruff
18+
name: Run Ruff (lint) on Tools/i18n/
19+
args: [--exit-non-zero-on-fix, --config=Tools/i18n/.ruff.toml]
20+
files: ^Tools/i18n/
1721
- id: ruff
1822
name: Run Ruff (lint) on Argument Clinic
1923
args: [--exit-non-zero-on-fix, --config=Tools/clinic/.ruff.toml]

Doc/deprecations/pending-removal-in-3.15.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,6 @@ Pending removal in Python 3.15
107107

108108
* :mod:`zipimport`:
109109

110-
* :meth:`~zipimport.zipimporter.load_module` has been deprecated since
110+
* :meth:`!zipimport.zipimporter.load_module` has been deprecated since
111111
Python 3.10. Use :meth:`~zipimport.zipimporter.exec_module` instead.
112-
(Contributed by Jiahao Li in :gh:`125746`.)
112+
(:gh:`125746`.)

Doc/howto/descriptor.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,7 @@ Here are three practical data validation utilities:
420420

421421
def validate(self, value):
422422
if not isinstance(value, str):
423-
raise TypeError(f'Expected {value!r} to be an str')
423+
raise TypeError(f'Expected {value!r} to be a str')
424424
if self.minsize is not None and len(value) < self.minsize:
425425
raise ValueError(
426426
f'Expected {value!r} to be no smaller than {self.minsize!r}'

Doc/library/exceptions.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -897,6 +897,9 @@ The following exceptions are used as warning categories; see the
897897

898898
Base class for warnings about dubious syntax.
899899

900+
This warning is typically emitted when compiling Python source code, and usually won't be reported
901+
when running already compiled code.
902+
900903

901904
.. exception:: RuntimeWarning
902905

Doc/library/ssl.rst

Lines changed: 29 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1684,19 +1684,33 @@ to speed up repeated connections from the same clients.
16841684

16851685
.. method:: SSLContext.set_ciphers(ciphers)
16861686

1687-
Set the available ciphers for sockets created with this context.
1688-
It should be a string in the `OpenSSL cipher list format
1687+
Set the allowed ciphers for sockets created with this context when
1688+
connecting using TLS 1.2 and earlier. The *ciphers* argument should
1689+
be a string in the `OpenSSL cipher list format
16891690
<https://docs.openssl.org/master/man1/ciphers/>`_.
1691+
To set allowed TLS 1.3 ciphers, use :meth:`SSLContext.set_ciphersuites`.
1692+
16901693
If no cipher can be selected (because compile-time options or other
16911694
configuration forbids use of all the specified ciphers), an
16921695
:class:`SSLError` will be raised.
16931696

16941697
.. note::
1695-
when connected, the :meth:`SSLSocket.cipher` method of SSL sockets will
1696-
give the currently selected cipher.
1698+
When connected, the :meth:`SSLSocket.cipher` method of SSL sockets will
1699+
return details about the negotiated cipher.
1700+
1701+
.. method:: SSLContext.set_ciphersuites(ciphersuites)
1702+
1703+
Set the allowed ciphers for sockets created with this context when
1704+
connecting using TLS 1.3. The *ciphersuites* argument should be a
1705+
colon-separate string of TLS 1.3 cipher names. If no cipher can be
1706+
selected (because compile-time options or other configuration forbids
1707+
use of all the specified ciphers), an :class:`SSLError` will be raised.
1708+
1709+
.. note::
1710+
When connected, the :meth:`SSLSocket.cipher` method of SSL sockets will
1711+
return details about the negotiated cipher.
16971712

1698-
TLS 1.3 cipher suites cannot be disabled with
1699-
:meth:`~SSLContext.set_ciphers`.
1713+
.. versionadded:: next
17001714

17011715
.. method:: SSLContext.set_groups(groups)
17021716

@@ -2845,10 +2859,15 @@ TLS 1.3
28452859
The TLS 1.3 protocol behaves slightly differently than previous version
28462860
of TLS/SSL. Some new TLS 1.3 features are not yet available.
28472861

2848-
- TLS 1.3 uses a disjunct set of cipher suites. All AES-GCM and
2849-
ChaCha20 cipher suites are enabled by default. The method
2850-
:meth:`SSLContext.set_ciphers` cannot enable or disable any TLS 1.3
2851-
ciphers yet, but :meth:`SSLContext.get_ciphers` returns them.
2862+
- TLS 1.3 uses a disjunct set of cipher suites. All AES-GCM and ChaCha20
2863+
cipher suites are enabled by default. To restrict which TLS 1.3 ciphers
2864+
are allowed, the :meth:`SSLContext.set_ciphersuites` method should be
2865+
called instead of :meth:`SSLContext.set_ciphers`, which only affects
2866+
ciphers in older TLS versions. The :meth:`SSLContext.get_ciphers` method
2867+
returns information about ciphers for both TLS 1.3 and earlier versions
2868+
and the method :meth:`SSLSocket.cipher` returns information about the
2869+
negotiated cipher for both TLS 1.3 and earlier versions once a connection
2870+
is established.
28522871
- Session tickets are no longer sent as part of the initial handshake and
28532872
are handled differently. :attr:`SSLSocket.session` and :class:`SSLSession`
28542873
are not compatible with TLS 1.3.

Doc/library/warnings.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,9 @@ The following warnings category classes are currently defined:
8080
| | unless triggered by code in ``__main__``). |
8181
+----------------------------------+-----------------------------------------------+
8282
| :exc:`SyntaxWarning` | Base category for warnings about dubious |
83-
| | syntactic features. |
83+
| | syntactic features (typically emitted when |
84+
| | compiling Python source code, and hence |
85+
| | may not be suppressed by runtime filters) |
8486
+----------------------------------+-----------------------------------------------+
8587
| :exc:`RuntimeWarning` | Base category for warnings about dubious |
8688
| | runtime features. |

Doc/library/zipimport.rst

Lines changed: 12 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -142,17 +142,6 @@ zipimporter Objects
142142
:exc:`ZipImportError` if the module couldn't be found.
143143

144144

145-
.. method:: load_module(fullname)
146-
147-
Load the module specified by *fullname*. *fullname* must be the fully
148-
qualified (dotted) module name. Returns the imported module on success,
149-
raises :exc:`ZipImportError` on failure.
150-
151-
.. deprecated-removed:: 3.10 3.15
152-
153-
Use :meth:`exec_module` instead.
154-
155-
156145
.. method:: invalidate_caches()
157146

158147
Clear out the internal cache of information about files found within
@@ -188,17 +177,20 @@ Here is an example that imports a module from a ZIP archive - note that the
188177

189178
.. code-block:: shell-session
190179
191-
$ unzip -l example.zip
192-
Archive: example.zip
180+
$ unzip -l example_archive.zip
181+
Archive: example_archive.zip
193182
Length Date Time Name
194183
-------- ---- ---- ----
195-
8467 11-26-02 22:30 jwzthreading.py
184+
8467 01-01-00 12:30 example.py
196185
-------- -------
197186
8467 1 file
198-
$ ./python
199-
Python 2.3 (#1, Aug 1 2003, 19:54:32)
187+
188+
.. code-block:: pycon
189+
200190
>>> import sys
201-
>>> sys.path.insert(0, 'example.zip') # Add .zip file to front of path
202-
>>> import jwzthreading
203-
>>> jwzthreading.__file__
204-
'example.zip/jwzthreading.py'
191+
>>> # Add the archive to the front of the module search path
192+
>>> sys.path.insert(0, 'example_archive.zip')
193+
>>> import example
194+
>>> example.__file__
195+
'example_archive.zip/example.py'
196+

Doc/whatsnew/3.15.rst

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -426,6 +426,13 @@ ssl
426426

427427
(Contributed by Ron Frederick in :gh:`136306`)
428428

429+
* Added a new method :meth:`ssl.SSLContext.set_ciphersuites` for setting TLS 1.3
430+
ciphers. For TLS 1.2 or earlier, :meth:`ssl.SSLContext.set_ciphers` should
431+
continue to be used. Both calls can be made on the same context and the
432+
selected cipher suite will depend on the TLS version negotiated when a
433+
connection is made.
434+
(Contributed by Ron Frederick in :gh:`137197`.)
435+
429436

430437
tarfile
431438
-------
@@ -611,6 +618,14 @@ wave
611618
(Contributed by Bénédikt Tran in :gh:`133873`.)
612619

613620

621+
zipimport
622+
---------
623+
624+
* Remove deprecated :meth:`!zipimport.zipimporter.load_module`.
625+
Use :meth:`zipimport.zipimporter.exec_module` instead.
626+
(Contributed by Jiahao Li in :gh:`133656`.)
627+
628+
614629
Porting to Python 3.15
615630
======================
616631

Lib/encodings/aliases.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,7 @@
318318
'iso_ir_157' : 'iso8859_10',
319319
'l6' : 'iso8859_10',
320320
'latin6' : 'iso8859_10',
321+
'latin_6' : 'iso8859_10',
321322

322323
# iso8859_11 codec
323324
'thai' : 'iso8859_11',
@@ -328,6 +329,7 @@
328329
'iso_8859_13' : 'iso8859_13',
329330
'l7' : 'iso8859_13',
330331
'latin7' : 'iso8859_13',
332+
'latin_7' : 'iso8859_13',
331333

332334
# iso8859_14 codec
333335
'iso_8859_14' : 'iso8859_14',
@@ -336,18 +338,21 @@
336338
'iso_ir_199' : 'iso8859_14',
337339
'l8' : 'iso8859_14',
338340
'latin8' : 'iso8859_14',
341+
'latin_8' : 'iso8859_14',
339342

340343
# iso8859_15 codec
341344
'iso_8859_15' : 'iso8859_15',
342345
'l9' : 'iso8859_15',
343346
'latin9' : 'iso8859_15',
347+
'latin_9' : 'iso8859_15',
344348

345349
# iso8859_16 codec
346350
'iso_8859_16' : 'iso8859_16',
347351
'iso_8859_16_2001' : 'iso8859_16',
348352
'iso_ir_226' : 'iso8859_16',
349353
'l10' : 'iso8859_16',
350354
'latin10' : 'iso8859_16',
355+
'latin_10' : 'iso8859_16',
351356

352357
# iso8859_2 codec
353358
'csisolatin2' : 'iso8859_2',
@@ -356,6 +361,7 @@
356361
'iso_ir_101' : 'iso8859_2',
357362
'l2' : 'iso8859_2',
358363
'latin2' : 'iso8859_2',
364+
'latin_2' : 'iso8859_2',
359365

360366
# iso8859_3 codec
361367
'csisolatin3' : 'iso8859_3',
@@ -364,6 +370,7 @@
364370
'iso_ir_109' : 'iso8859_3',
365371
'l3' : 'iso8859_3',
366372
'latin3' : 'iso8859_3',
373+
'latin_3' : 'iso8859_3',
367374

368375
# iso8859_4 codec
369376
'csisolatin4' : 'iso8859_4',
@@ -372,6 +379,7 @@
372379
'iso_ir_110' : 'iso8859_4',
373380
'l4' : 'iso8859_4',
374381
'latin4' : 'iso8859_4',
382+
'latin_4' : 'iso8859_4',
375383

376384
# iso8859_5 codec
377385
'csisolatincyrillic' : 'iso8859_5',
@@ -415,6 +423,7 @@
415423
'iso_ir_148' : 'iso8859_9',
416424
'l5' : 'iso8859_9',
417425
'latin5' : 'iso8859_9',
426+
'latin_5' : 'iso8859_9',
418427

419428
# johab codec
420429
'cp1361' : 'johab',

Lib/platform.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,11 @@ def libc_ver(executable=None, lib='', version='', chunksize=16384):
173173
174174
"""
175175
if not executable:
176+
if sys.platform == "emscripten":
177+
# Emscripten's os.confstr reports that it is glibc, so special case
178+
# it.
179+
ver = ".".join(str(x) for x in sys._emscripten_info.emscripten_version)
180+
return ("emscripten", ver)
176181
try:
177182
ver = os.confstr('CS_GNU_LIBC_VERSION')
178183
# parse 'glibc 2.28' as ('glibc', '2.28')

0 commit comments

Comments
 (0)