Skip to content

Commit 9269496

Browse files
committed
Merge branch 'main' into docs/whatsnew/removed
2 parents 6d921af + 75d20b2 commit 9269496

File tree

3 files changed

+110
-85
lines changed

3 files changed

+110
-85
lines changed

Doc/library/concurrent.futures.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,10 +101,10 @@ Executor Objects
101101
executor has started running will be completed prior to this method
102102
returning. The remaining futures are cancelled.
103103

104-
You can avoid having to call this method explicitly if you use the
105-
:keyword:`with` statement, which will shutdown the :class:`Executor`
106-
(waiting as if :meth:`Executor.shutdown` were called with *wait* set to
107-
``True``)::
104+
You can avoid having to call this method explicitly if you use the executor
105+
as a :term:`context manager` via the :keyword:`with` statement, which
106+
will shutdown the :class:`Executor` (waiting as if :meth:`Executor.shutdown`
107+
were called with *wait* set to ``True``)::
108108

109109
import shutil
110110
with ThreadPoolExecutor(max_workers=4) as e:

Doc/library/pdb.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ The debugger's prompt is ``(Pdb)``, which is the indicator that you are in debug
7575
arguments of the ``p`` command.
7676

7777

78+
.. _pdb-cli:
7879
.. program:: pdb
7980

8081
You can also invoke :mod:`pdb` from the command line to debug other scripts. For

Doc/whatsnew/3.14.rst

Lines changed: 105 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -1299,12 +1299,11 @@ asyncio
12991299
:meth:`asyncio.TaskGroup.create_task`.
13001300
(Contributed by Thomas Grainger in :gh:`128307`.)
13011301

1302-
1303-
bdb
1304-
---
1305-
1306-
* The :mod:`bdb` module now supports the :mod:`sys.monitoring` backend.
1307-
(Contributed by Tian Gao in :gh:`124533`.)
1302+
* There are two new utility functions for
1303+
introspecting and printing a program's call graph:
1304+
:func:`~asyncio.capture_call_graph` and :func:`~asyncio.print_call_graph`.
1305+
(Contributed by Yury Selivanov, Pablo Galindo Salgado, and Łukasz Langa
1306+
in :gh:`91048`.)
13081307

13091308

13101309
.. _whatsnew314-color-calendar:
@@ -1532,36 +1531,6 @@ functools
15321531
(Contributed by Sayandip Dutta in :gh:`125916`.)
15331532

15341533

1535-
gc
1536-
--
1537-
1538-
The cyclic garbage collector is now incremental,
1539-
which changes the meaning of the results of
1540-
:meth:`~gc.get_threshold` and :meth:`~gc.set_threshold`
1541-
as well as :meth:`~gc.get_count` and :meth:`~gc.get_stats`.
1542-
1543-
* For backwards compatibility, :meth:`~gc.get_threshold` continues to return
1544-
a three-item tuple.
1545-
The first value is the threshold for young collections, as before;
1546-
the second value determines the rate at which the old collection is scanned
1547-
(the default is 10, and higher values mean that the old collection
1548-
is scanned more slowly).
1549-
The third value is meaningless and is always zero.
1550-
1551-
* :meth:`~gc.set_threshold` ignores any items after the second.
1552-
1553-
* :meth:`~gc.get_count` and :meth:`~gc.get_stats` continue to return
1554-
the same format of results.
1555-
The only difference is that instead of the results referring to
1556-
the young, aging and old generations,
1557-
the results refer to the young generation
1558-
and the aging and collecting spaces of the old generation.
1559-
1560-
In summary, code that attempted to manipulate the behavior of the cycle GC
1561-
may not work exactly as intended, but it is very unlikely to be harmful.
1562-
All other code will work just fine.
1563-
1564-
15651534
getopt
15661535
------
15671536

@@ -1930,13 +1899,6 @@ pdb
19301899
* ``$_asynctask`` is added to access the current asyncio task if applicable.
19311900
(Contributed by Tian Gao in :gh:`124367`.)
19321901

1933-
* :mod:`pdb` now supports two backends: :func:`sys.settrace` and
1934-
:mod:`sys.monitoring`. Using :mod:`pdb` CLI or :func:`breakpoint` will
1935-
always use the :mod:`sys.monitoring` backend. Explicitly instantiating
1936-
:class:`pdb.Pdb` and its derived classes will use the :func:`sys.settrace`
1937-
backend by default, which is configurable.
1938-
(Contributed by Tian Gao in :gh:`124533`.)
1939-
19401902
* :func:`pdb.set_trace_async` is added to support debugging asyncio
19411903
coroutines. :keyword:`await` statements are supported with this
19421904
function.
@@ -2277,14 +2239,16 @@ zipinfo
22772239

22782240
.. Add improved modules above alphabetically, not here at the end.
22792241
2242+
22802243
Optimizations
22812244
=============
22822245

22832246
* The import time for several standard library modules has been improved,
2284-
including :mod:`ast`, :mod:`asyncio`, :mod:`base64`, :mod:`cmd`, :mod:`csv`,
2285-
:mod:`gettext`, :mod:`importlib.util`, :mod:`locale`, :mod:`mimetypes`,
2286-
:mod:`optparse`, :mod:`pickle`, :mod:`pprint`, :mod:`pstats`, :mod:`socket`,
2287-
:mod:`subprocess`, :mod:`threading`, :mod:`tomllib`, and :mod:`zipfile`.
2247+
including :mod:`annotationlib`, :mod:`ast`, :mod:`asyncio`, :mod:`base64`,
2248+
:mod:`cmd`, :mod:`csv`, :mod:`gettext`, :mod:`importlib.util`, :mod:`locale`,
2249+
:mod:`mimetypes`, :mod:`optparse`, :mod:`pickle`, :mod:`pprint`,
2250+
:mod:`pstats`, :mod:`shlex`, :mod:`socket`, :mod:`string`, :mod:`subprocess`,
2251+
:mod:`threading`, :mod:`tomllib`, :mod:`types`, and :mod:`zipfile`.
22882252

22892253
(Contributed by Adam Turner, Bénédikt Tran, Chris Markiewicz, Eli Schwartz,
22902254
Hugo van Kemenade, Jelle Zijlstra, and others in :gh:`118761`.)
@@ -2293,32 +2257,44 @@ Optimizations
22932257
asyncio
22942258
-------
22952259

2296-
* :mod:`asyncio` has a new per-thread double linked list implementation internally for
2297-
:class:`native tasks <asyncio.Task>` which speeds up execution by 10-20% on standard
2298-
pyperformance benchmarks and reduces memory usage.
2260+
* Standard benchmark results have improved by 10-20%, following the
2261+
implementation of a new per-thread double linked list
2262+
for :class:`native tasks <asyncio.Task>`,
2263+
also reducing memory usage.
22992264
This enables external introspection tools such as
23002265
:ref:`python -m asyncio pstree <whatsnew314-asyncio-introspection>`
23012266
to introspect the call graph of asyncio tasks running in all threads.
23022267
(Contributed by Kumar Aditya in :gh:`107803`.)
23032268

2304-
* :mod:`asyncio` has first class support for :term:`free-threading builds <free threading>`.
2305-
This enables parallel execution of multiple event loops across different threads and scales
2306-
linearly with the number of threads.
2269+
* The module now has first class support for
2270+
:term:`free-threading builds <free threading>`.
2271+
This enables parallel execution of multiple event loops across
2272+
different threads, scaling linearly with the number of threads.
23072273
(Contributed by Kumar Aditya in :gh:`128002`.)
23082274

2309-
* :mod:`asyncio` has new utility functions for introspecting and printing
2310-
the program's call graph: :func:`asyncio.capture_call_graph` and
2311-
:func:`asyncio.print_call_graph`.
2312-
(Contributed by Yury Selivanov, Pablo Galindo Salgado, and Łukasz Langa
2313-
in :gh:`91048`.)
2314-
23152275

23162276
base64
23172277
------
23182278

2319-
* Improve the performance of :func:`base64.b16decode` by up to ten times,
2320-
and reduce the import time of :mod:`base64` by up to six times.
2321-
(Contributed by Bénédikt Tran, Chris Markiewicz, and Adam Turner in :gh:`118761`.)
2279+
* :func:`~base64.b16decode` is now up to six times faster.
2280+
(Contributed by Bénédikt Tran, Chris Markiewicz, and Adam Turner
2281+
in :gh:`118761`.)
2282+
2283+
2284+
bdb
2285+
---
2286+
2287+
* The basic debugger now has a :mod:`sys.monitoring`-based backend,
2288+
which can be selected via the passing ``'monitoring'``
2289+
to the :class:`~bdb.Bdb` class's new *backend* parameter.
2290+
(Contributed by Tian Gao in :gh:`124533`.)
2291+
2292+
2293+
difflib
2294+
-------
2295+
2296+
* The :func:`~difflib.IS_LINE_JUNK` function is now up to twice as fast.
2297+
(Contributed by Adam Turner and Semyon Moroz in :gh:`130167`.)
23222298

23232299

23242300
gc
@@ -2327,42 +2303,90 @@ gc
23272303
* The new :ref:`incremental garbage collector <whatsnew314-incremental-gc>`
23282304
means that maximum pause times are reduced
23292305
by an order of magnitude or more for larger heaps.
2306+
2307+
Because of this optimization, the meaning of the results of
2308+
:meth:`~gc.get_threshold` and :meth:`~gc.set_threshold` have changed,
2309+
along with :meth:`~gc.get_count` and :meth:`~gc.get_stats`.
2310+
2311+
- For backwards compatibility, :meth:`~gc.get_threshold` continues to return
2312+
a three-item tuple.
2313+
The first value is the threshold for young collections, as before;
2314+
the second value determines the rate at which the old collection is scanned
2315+
(the default is 10, and higher values mean that the old collection
2316+
is scanned more slowly).
2317+
The third value is now meaningless and is always zero.
2318+
2319+
- :meth:`~gc.set_threshold` now ignores any items after the second.
2320+
2321+
- :meth:`~gc.get_count` and :meth:`~gc.get_stats` continue to return
2322+
the same format of results.
2323+
The only difference is that instead of the results referring to
2324+
the young, aging and old generations,
2325+
the results refer to the young generation
2326+
and the aging and collecting spaces of the old generation.
2327+
2328+
In summary, code that attempted to manipulate the behavior of the cycle GC
2329+
may not work exactly as intended, but it is very unlikely to be harmful.
2330+
All other code will work just fine.
2331+
23302332
(Contributed by Mark Shannon in :gh:`108362`.)
23312333

23322334

23332335
io
23342336
---
2335-
* :mod:`io` which provides the built-in :func:`open` makes less system calls
2336-
when opening regular files as well as reading whole files. Reading a small
2337-
operating system cached file in full is up to 15% faster.
2338-
:func:`pathlib.Path.read_bytes` has the most optimizations for reading a
2339-
file's bytes in full. (Contributed by Cody Maloney and Victor Stinner in
2340-
:gh:`120754` and :gh:`90102`.)
2337+
2338+
* Opening and reading files now executes fewer system calls.
2339+
Reading a small operating system cached file in full is up to 15% faster.
2340+
(Contributed by Cody Maloney and Victor Stinner
2341+
in :gh:`120754` and :gh:`90102`.)
2342+
2343+
2344+
pathlib
2345+
-------
2346+
2347+
* :func:`Path.read_bytes <pathlib.Path.read_bytes>` now uses unbuffered mode
2348+
to open files, which is between 9% and 17% faster to read in full.
2349+
(Contributed by Cody Maloney in :gh:`120754`.)
2350+
2351+
2352+
pdb
2353+
---
2354+
2355+
* :mod:`pdb` now supports two backends, based on either
2356+
:func:`sys.settrace` or :mod:`sys.monitoring`.
2357+
Using the :ref:`pdb CLI <pdb-cli>` or :func:`breakpoint`
2358+
will always use the :mod:`sys.monitoring` backend.
2359+
Explicitly instantiating :class:`pdb.Pdb` and its derived classes
2360+
will use the :func:`sys.settrace` backend by default, which is configurable.
2361+
(Contributed by Tian Gao in :gh:`124533`.)
23412362

23422363

23432364
uuid
23442365
----
23452366

2346-
* Improve generation of :class:`~uuid.UUID` objects via their dedicated
2347-
functions:
2348-
2349-
* :func:`~uuid.uuid3` and :func:`~uuid.uuid5` are both roughly 40% faster
2350-
for 16-byte names and 20% faster for 1024-byte names. Performance for
2351-
longer names remains unchanged.
2352-
* :func:`~uuid.uuid4` is 30% faster.
2367+
* :func:`~uuid.uuid3` and :func:`~uuid.uuid5` are now both roughly 40% faster
2368+
for 16-byte names and 20% faster for 1024-byte names.
2369+
Performance for longer names remains unchanged.
2370+
(Contributed by Bénédikt Tran in :gh:`128150`.)
23532371

2372+
* :func:`~uuid.uuid4` is now c. 30% faster.
23542373
(Contributed by Bénédikt Tran in :gh:`128150`.)
23552374

23562375

23572376
zlib
23582377
----
23592378

2360-
* On Windows, ``zlib-ng`` is now used as the implementation of the
2361-
:mod:`zlib` module. This should produce compatible and comparable
2362-
results with better performance, though it is worth noting that
2363-
``zlib.Z_BEST_SPEED`` (1) may result in significantly less
2364-
compression than the previous implementation (while also significantly
2365-
reducing the time taken to compress).
2379+
* On Windows, `zlib-ng <https://github.com/zlib-ng/zlib-ng>`__
2380+
is now used as the implementation of the :mod:`zlib` module
2381+
in the default binaries.
2382+
There are no known incompatabilities between ``zlib-ng``
2383+
and the previously-used ``zlib`` implementation.
2384+
This should result in better performance at all compression levels.
2385+
2386+
It is worth noting that ``zlib.Z_BEST_SPEED`` (``1``) may result in
2387+
significantly less compression than the previous implementation,
2388+
whilst also significantly reducing the time taken to compress.
2389+
23662390
(Contributed by Steve Dower in :gh:`91349`.)
23672391

23682392

0 commit comments

Comments
 (0)