Skip to content

Commit 377d061

Browse files
authored
Merge branch 'main' into hy/drop_useless_code_in_zipimport
2 parents b880e3f + 38d4b43 commit 377d061

33 files changed

+429
-169
lines changed

Doc/c-api/iter.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,6 @@ There are two functions specifically for working with iterators.
5454
5555
- ``PYGEN_RETURN`` if iterator returns. Return value is returned via *presult*.
5656
- ``PYGEN_NEXT`` if iterator yields. Yielded value is returned via *presult*.
57-
- ``PYGEN_ERROR`` if iterator has raised and exception. *presult* is set to ``NULL``.
57+
- ``PYGEN_ERROR`` if iterator has raised an exception. *presult* is set to ``NULL``.
5858
5959
.. versionadded:: 3.10

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ Pending removal in Python 3.20
88
- :mod:`argparse`
99
- :mod:`csv`
1010
- :mod:`!ctypes.macholib`
11+
- :mod:`imaplib`
1112
- :mod:`ipaddress`
1213
- :mod:`json`
1314
- :mod:`logging` (``__date__`` also deprecated)

Doc/library/functools.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ The :mod:`functools` module defines the following functions:
190190

191191
Note, type specificity applies only to the function's immediate arguments
192192
rather than their contents. The scalar arguments, ``Decimal(42)`` and
193-
``Fraction(42)`` are be treated as distinct calls with distinct results.
193+
``Fraction(42)`` are treated as distinct calls with distinct results.
194194
In contrast, the tuple arguments ``('answer', Decimal(42))`` and
195195
``('answer', Fraction(42))`` are treated as equivalent.
196196

Doc/library/glob.rst

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,23 +18,27 @@
1818
single: - (minus); in glob-style wildcards
1919
single: . (dot); in glob-style wildcards
2020

21-
The :mod:`glob` module finds all the pathnames matching a specified pattern
22-
according to the rules used by the Unix shell, although results are returned in
23-
arbitrary order. No tilde expansion is done, but ``*``, ``?``, and character
21+
The :mod:`!glob` module finds pathnames
22+
using pattern matching rules similar to the Unix shell.
23+
No tilde expansion is done, but ``*``, ``?``, and character
2424
ranges expressed with ``[]`` will be correctly matched. This is done by using
2525
the :func:`os.scandir` and :func:`fnmatch.fnmatch` functions in concert, and
2626
not by actually invoking a subshell.
2727

28-
Note that files beginning with a dot (``.``) can only be matched by
28+
.. note::
29+
The pathnames are returned in no particular order. If you need a specific
30+
order, sort the results.
31+
32+
Files beginning with a dot (``.``) can only be matched by
2933
patterns that also start with a dot,
3034
unlike :func:`fnmatch.fnmatch` or :func:`pathlib.Path.glob`.
31-
(For tilde and shell variable expansion, use :func:`os.path.expanduser` and
32-
:func:`os.path.expandvars`.)
35+
For tilde and shell variable expansion, use :func:`os.path.expanduser` and
36+
:func:`os.path.expandvars`.
3337

3438
For a literal match, wrap the meta-characters in brackets.
3539
For example, ``'[?]'`` matches the character ``'?'``.
3640

37-
The :mod:`glob` module defines the following functions:
41+
The :mod:`!glob` module defines the following functions:
3842

3943

4044
.. function:: glob(pathname, *, root_dir=None, dir_fd=None, recursive=False, \
@@ -51,7 +55,7 @@ The :mod:`glob` module defines the following functions:
5155

5256
If *root_dir* is not ``None``, it should be a :term:`path-like object`
5357
specifying the root directory for searching. It has the same effect on
54-
:func:`glob` as changing the current directory before calling it. If
58+
:func:`!glob` as changing the current directory before calling it. If
5559
*pathname* is relative, the result will contain paths relative to
5660
*root_dir*.
5761

Doc/library/os.rst

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3451,7 +3451,10 @@ features:
34513451

34523452
.. attribute:: stx_mnt_id
34533453

3454-
Mount ID.
3454+
Mount identifier.
3455+
3456+
Equal to ``None`` if :data:`STATX_MNT_ID` is missing from
3457+
:attr:`~os.statx_result.stx_mask`.
34553458

34563459
.. availability:: Linux >= 4.11 with glibc >= 2.28 and build-time kernel
34573460
userspace API headers >= 5.8.
@@ -3460,19 +3463,28 @@ features:
34603463

34613464
Direct I/O memory buffer alignment requirement.
34623465

3466+
Equal to ``None`` if :data:`STATX_DIOALIGN` is missing from
3467+
:attr:`~os.statx_result.stx_mask`.
3468+
34633469
.. availability:: Linux >= 4.11 with glibc >= 2.28 and build-time kernel
34643470
userspace API headers >= 6.1.
34653471

34663472
.. attribute:: stx_dio_offset_align
34673473

34683474
Direct I/O file offset alignment requirement.
34693475

3476+
Equal to ``None`` if :data:`STATX_DIOALIGN` is missing from
3477+
:attr:`~os.statx_result.stx_mask`.
3478+
34703479
.. availability:: Linux >= 4.11 with glibc >= 2.28 and build-time kernel
34713480
userspace API headers >= 6.1.
34723481

34733482
.. attribute:: stx_subvol
34743483

3475-
Subvolume ID.
3484+
Subvolume identifier.
3485+
3486+
Equal to ``None`` if :data:`STATX_SUBVOL` is missing from
3487+
:attr:`~os.statx_result.stx_mask`.
34763488

34773489
.. availability:: Linux >= 4.11 with glibc >= 2.28 and build-time kernel
34783490
userspace API headers >= 6.10.
@@ -3481,34 +3493,49 @@ features:
34813493

34823494
Minimum size for direct I/O with torn-write protection.
34833495

3496+
Equal to ``None`` if :data:`STATX_WRITE_ATOMIC` is missing from
3497+
:attr:`~os.statx_result.stx_mask`.
3498+
34843499
.. availability:: Linux >= 4.11 with glibc >= 2.28 and build-time kernel
34853500
userspace API headers >= 6.11.
34863501

34873502
.. attribute:: stx_atomic_write_unit_max
34883503

34893504
Maximum size for direct I/O with torn-write protection.
34903505

3506+
Equal to ``None`` if :data:`STATX_WRITE_ATOMIC` is missing from
3507+
:attr:`~os.statx_result.stx_mask`.
3508+
34913509
.. availability:: Linux >= 4.11 with glibc >= 2.28 and build-time kernel
34923510
userspace API headers >= 6.11.
34933511

34943512
.. attribute:: stx_atomic_write_unit_max_opt
34953513

34963514
Maximum optimized size for direct I/O with torn-write protection.
34973515

3516+
Equal to ``None`` if :data:`STATX_WRITE_ATOMIC` is missing from
3517+
:attr:`~os.statx_result.stx_mask`.
3518+
34983519
.. availability:: Linux >= 4.11 with glibc >= 2.28 and build-time kernel
34993520
userspace API headers >= 6.16.
35003521

35013522
.. attribute:: stx_atomic_write_segments_max
35023523

35033524
Maximum iovecs for direct I/O with torn-write protection.
35043525

3526+
Equal to ``None`` if :data:`STATX_WRITE_ATOMIC` is missing from
3527+
:attr:`~os.statx_result.stx_mask`.
3528+
35053529
.. availability:: Linux >= 4.11 with glibc >= 2.28 and build-time kernel
35063530
userspace API headers >= 6.11.
35073531

35083532
.. attribute:: stx_dio_read_offset_align
35093533

35103534
Direct I/O file offset alignment requirement for reads.
35113535

3536+
Equal to ``None`` if :data:`STATX_DIO_READ_ALIGN` is missing from
3537+
:attr:`~os.statx_result.stx_mask`.
3538+
35123539
.. availability:: Linux >= 4.11 with glibc >= 2.28 and build-time kernel
35133540
userspace API headers >= 6.14.
35143541

Doc/library/resource.rst

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ platform.
141141
.. data:: RLIMIT_CPU
142142

143143
The maximum amount of processor time (in seconds) that a process can use. If
144-
this limit is exceeded, a :const:`SIGXCPU` signal is sent to the process. (See
144+
this limit is exceeded, a :const:`~signal.SIGXCPU` signal is sent to the process. (See
145145
the :mod:`signal` module documentation for information about how to catch this
146146
signal and do something useful, e.g. flush open files to disk.)
147147

@@ -363,47 +363,47 @@ These functions are used to retrieve resource usage information:
363363
For backward compatibility, the return value is also accessible as a tuple of 16
364364
elements.
365365

366-
The fields :attr:`ru_utime` and :attr:`ru_stime` of the return value are
366+
The fields :attr:`!ru_utime` and :attr:`!ru_stime` of the return value are
367367
floating-point values representing the amount of time spent executing in user
368368
mode and the amount of time spent executing in system mode, respectively. The
369369
remaining values are integers. Consult the :manpage:`getrusage(2)` man page for
370370
detailed information about these values. A brief summary is presented here:
371371

372-
+--------+---------------------+---------------------------------------+
373-
| Index | Field | Resource |
374-
+========+=====================+=======================================+
375-
| ``0`` | :attr:`ru_utime` | time in user mode (float seconds) |
376-
+--------+---------------------+---------------------------------------+
377-
| ``1`` | :attr:`ru_stime` | time in system mode (float seconds) |
378-
+--------+---------------------+---------------------------------------+
379-
| ``2`` | :attr:`ru_maxrss` | maximum resident set size |
380-
+--------+---------------------+---------------------------------------+
381-
| ``3`` | :attr:`ru_ixrss` | shared memory size |
382-
+--------+---------------------+---------------------------------------+
383-
| ``4`` | :attr:`ru_idrss` | unshared memory size |
384-
+--------+---------------------+---------------------------------------+
385-
| ``5`` | :attr:`ru_isrss` | unshared stack size |
386-
+--------+---------------------+---------------------------------------+
387-
| ``6`` | :attr:`ru_minflt` | page faults not requiring I/O |
388-
+--------+---------------------+---------------------------------------+
389-
| ``7`` | :attr:`ru_majflt` | page faults requiring I/O |
390-
+--------+---------------------+---------------------------------------+
391-
| ``8`` | :attr:`ru_nswap` | number of swap outs |
392-
+--------+---------------------+---------------------------------------+
393-
| ``9`` | :attr:`ru_inblock` | block input operations |
394-
+--------+---------------------+---------------------------------------+
395-
| ``10`` | :attr:`ru_oublock` | block output operations |
396-
+--------+---------------------+---------------------------------------+
397-
| ``11`` | :attr:`ru_msgsnd` | messages sent |
398-
+--------+---------------------+---------------------------------------+
399-
| ``12`` | :attr:`ru_msgrcv` | messages received |
400-
+--------+---------------------+---------------------------------------+
401-
| ``13`` | :attr:`ru_nsignals` | signals received |
402-
+--------+---------------------+---------------------------------------+
403-
| ``14`` | :attr:`ru_nvcsw` | voluntary context switches |
404-
+--------+---------------------+---------------------------------------+
405-
| ``15`` | :attr:`ru_nivcsw` | involuntary context switches |
406-
+--------+---------------------+---------------------------------------+
372+
+--------+----------------------+---------------------------------------+
373+
| Index | Field | Resource |
374+
+========+======================+=======================================+
375+
| ``0`` | :attr:`!ru_utime` | time in user mode (float seconds) |
376+
+--------+----------------------+---------------------------------------+
377+
| ``1`` | :attr:`!ru_stime` | time in system mode (float seconds) |
378+
+--------+----------------------+---------------------------------------+
379+
| ``2`` | :attr:`!ru_maxrss` | maximum resident set size |
380+
+--------+----------------------+---------------------------------------+
381+
| ``3`` | :attr:`!ru_ixrss` | shared memory size |
382+
+--------+----------------------+---------------------------------------+
383+
| ``4`` | :attr:`!ru_idrss` | unshared memory size |
384+
+--------+----------------------+---------------------------------------+
385+
| ``5`` | :attr:`!ru_isrss` | unshared stack size |
386+
+--------+----------------------+---------------------------------------+
387+
| ``6`` | :attr:`!ru_minflt` | page faults not requiring I/O |
388+
+--------+----------------------+---------------------------------------+
389+
| ``7`` | :attr:`!ru_majflt` | page faults requiring I/O |
390+
+--------+----------------------+---------------------------------------+
391+
| ``8`` | :attr:`!ru_nswap` | number of swap outs |
392+
+--------+----------------------+---------------------------------------+
393+
| ``9`` | :attr:`!ru_inblock` | block input operations |
394+
+--------+----------------------+---------------------------------------+
395+
| ``10`` | :attr:`!ru_oublock` | block output operations |
396+
+--------+----------------------+---------------------------------------+
397+
| ``11`` | :attr:`!ru_msgsnd` | messages sent |
398+
+--------+----------------------+---------------------------------------+
399+
| ``12`` | :attr:`!ru_msgrcv` | messages received |
400+
+--------+----------------------+---------------------------------------+
401+
| ``13`` | :attr:`!ru_nsignals` | signals received |
402+
+--------+----------------------+---------------------------------------+
403+
| ``14`` | :attr:`!ru_nvcsw` | voluntary context switches |
404+
+--------+----------------------+---------------------------------------+
405+
| ``15`` | :attr:`!ru_nivcsw` | involuntary context switches |
406+
+--------+----------------------+---------------------------------------+
407407

408408
This function will raise a :exc:`ValueError` if an invalid *who* parameter is
409409
specified. It may also raise :exc:`error` exception in unusual circumstances.

Doc/library/signal.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,12 @@ The variables defined in the :mod:`signal` module are:
265265

266266
.. availability:: Unix.
267267

268+
.. data:: SIGXCPU
269+
270+
CPU time limit exceeded.
271+
272+
.. availability:: Unix.
273+
268274
.. data:: SIG*
269275

270276
All the signal numbers are defined symbolically. For example, the hangup signal

Doc/library/zlib.rst

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -56,21 +56,20 @@ The available exception and functions in this module are:
5656

5757
.. versionadded:: 3.15
5858

59-
.. function:: compress(data, /, level=-1, wbits=MAX_WBITS)
59+
.. function:: compress(data, /, level=Z_DEFAULT_COMPRESSION, wbits=MAX_WBITS)
6060

6161
Compresses the bytes in *data*, returning a bytes object containing compressed data.
6262
*level* is an integer from ``0`` to ``9`` or ``-1`` controlling the level of compression;
63-
``1`` (Z_BEST_SPEED) is fastest and produces the least compression, ``9`` (Z_BEST_COMPRESSION)
64-
is slowest and produces the most. ``0`` (Z_NO_COMPRESSION) is no compression.
65-
The default value is ``-1`` (Z_DEFAULT_COMPRESSION). Z_DEFAULT_COMPRESSION represents a default
66-
compromise between speed and compression (currently equivalent to level 6).
63+
See :const:`Z_BEST_SPEED` (``1``), :const:`Z_BEST_COMPRESSION` (``9``),
64+
:const:`Z_NO_COMPRESSION` (``0``), and the default,
65+
:const:`Z_DEFAULT_COMPRESSION` (``-1``) for more information about these values.
6766

6867
.. _compress-wbits:
6968

7069
The *wbits* argument controls the size of the history buffer (or the
7170
"window size") used when compressing data, and whether a header and
7271
trailer is included in the output. It can take several ranges of values,
73-
defaulting to ``15`` (MAX_WBITS):
72+
defaulting to ``15`` (:const:`MAX_WBITS`):
7473

7574
* +9 to +15: The base-two logarithm of the window size, which
7675
therefore ranges between 512 and 32768. Larger values produce
@@ -94,17 +93,15 @@ The available exception and functions in this module are:
9493
The *wbits* parameter is now available to set window bits and
9594
compression type.
9695

97-
.. function:: compressobj(level=-1, method=DEFLATED, wbits=MAX_WBITS, memLevel=DEF_MEM_LEVEL, strategy=Z_DEFAULT_STRATEGY[, zdict])
96+
.. function:: compressobj(level=Z_DEFAULT_COMPRESSION, method=DEFLATED, wbits=MAX_WBITS, memLevel=DEF_MEM_LEVEL, strategy=Z_DEFAULT_STRATEGY[, zdict])
9897

9998
Returns a compression object, to be used for compressing data streams that won't
10099
fit into memory at once.
101100

102101
*level* is the compression level -- an integer from ``0`` to ``9`` or ``-1``.
103-
A value of ``1`` (Z_BEST_SPEED) is fastest and produces the least compression,
104-
while a value of ``9`` (Z_BEST_COMPRESSION) is slowest and produces the most.
105-
``0`` (Z_NO_COMPRESSION) is no compression. The default value is ``-1`` (Z_DEFAULT_COMPRESSION).
106-
Z_DEFAULT_COMPRESSION represents a default compromise between speed and compression
107-
(currently equivalent to level 6).
102+
See :const:`Z_BEST_SPEED` (``1``), :const:`Z_BEST_COMPRESSION` (``9``),
103+
:const:`Z_NO_COMPRESSION` (``0``), and the default,
104+
:const:`Z_DEFAULT_COMPRESSION` (``-1``) for more information about these values.
108105

109106
*method* is the compression algorithm. Currently, the only supported value is
110107
:const:`DEFLATED`.
@@ -119,7 +116,7 @@ The available exception and functions in this module are:
119116

120117
*strategy* is used to tune the compression algorithm. Possible values are
121118
:const:`Z_DEFAULT_STRATEGY`, :const:`Z_FILTERED`, :const:`Z_HUFFMAN_ONLY`,
122-
:const:`Z_RLE` (zlib 1.2.0.1) and :const:`Z_FIXED` (zlib 1.2.2.2).
119+
:const:`Z_RLE` and :const:`Z_FIXED`.
123120

124121
*zdict* is a predefined compression dictionary. This is a sequence of bytes
125122
(such as a :class:`bytes` object) containing subsequences that are expected
@@ -247,7 +244,7 @@ Compression objects support the following methods:
247244
All pending input is processed, and a bytes object containing the remaining compressed
248245
output is returned. *mode* can be selected from the constants
249246
:const:`Z_NO_FLUSH`, :const:`Z_PARTIAL_FLUSH`, :const:`Z_SYNC_FLUSH`,
250-
:const:`Z_FULL_FLUSH`, :const:`Z_BLOCK` (zlib 1.2.3.4), or :const:`Z_FINISH`,
247+
:const:`Z_FULL_FLUSH`, :const:`Z_BLOCK`, or :const:`Z_FINISH`,
251248
defaulting to :const:`Z_FINISH`. Except :const:`Z_FINISH`, all constants
252249
allow compressing further bytestrings of data, while :const:`Z_FINISH` finishes the
253250
compressed stream and prevents compressing any more data. After calling :meth:`flush`
@@ -365,24 +362,25 @@ behavior:
365362

366363
.. data:: Z_NO_COMPRESSION
367364

368-
Compression level ``0``.
365+
Compression level ``0``; no compression.
369366

370367
.. versionadded:: 3.6
371368

372369

373370
.. data:: Z_BEST_SPEED
374371

375-
Compression level ``1``.
372+
Compression level ``1``; fastest and produces the least compression.
376373

377374

378375
.. data:: Z_BEST_COMPRESSION
379376

380-
Compression level ``9``.
377+
Compression level ``9``; slowest and produces the most compression.
381378

382379

383380
.. data:: Z_DEFAULT_COMPRESSION
384381

385-
Default compression level (``-1``).
382+
Default compression level (``-1``); a compromise between speed and
383+
compression. Currently equivalent to compression level ``6``.
386384

387385

388386
.. data:: Z_DEFAULT_STRATEGY

0 commit comments

Comments
 (0)