Skip to content

Commit 65cf376

Browse files
Merge branch 'main' into strftime-runtime-checks
2 parents 26441f9 + 3feac7a commit 65cf376

155 files changed

Lines changed: 1819 additions & 488 deletions

File tree

Some content is hidden

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

.github/workflows/mypy.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,4 +59,5 @@ jobs:
5959
cache: pip
6060
cache-dependency-path: Tools/requirements-dev.txt
6161
- run: pip install -r Tools/requirements-dev.txt
62+
- run: python3 Misc/mypy/make_symlinks.py --symlink
6263
- run: mypy --config-file ${{ matrix.target }}/mypy.ini

Doc/c-api/arg.rst

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,14 +113,18 @@ There are three ways strings and buffers can be converted to C:
113113
``z`` (:class:`str` or ``None``) [const char \*]
114114
Like ``s``, but the Python object may also be ``None``, in which case the C
115115
pointer is set to ``NULL``.
116+
It is the same as ``s?`` with the C pointer was initialized to ``NULL``.
116117

117118
``z*`` (:class:`str`, :term:`bytes-like object` or ``None``) [Py_buffer]
118119
Like ``s*``, but the Python object may also be ``None``, in which case the
119120
``buf`` member of the :c:type:`Py_buffer` structure is set to ``NULL``.
121+
It is the same as ``s*?`` with the ``buf`` member of the :c:type:`Py_buffer`
122+
structure was initialized to ``NULL``.
120123

121124
``z#`` (:class:`str`, read-only :term:`bytes-like object` or ``None``) [const char \*, :c:type:`Py_ssize_t`]
122125
Like ``s#``, but the Python object may also be ``None``, in which case the C
123126
pointer is set to ``NULL``.
127+
It is the same as ``s#?`` with the C pointer was initialized to ``NULL``.
124128

125129
``y`` (read-only :term:`bytes-like object`) [const char \*]
126130
This format converts a bytes-like object to a C pointer to a
@@ -357,11 +361,37 @@ Other objects
357361

358362
.. versionadded:: 3.3
359363

360-
``(items)`` (:class:`tuple`) [*matching-items*]
361-
The object must be a Python sequence whose length is the number of format units
364+
``(items)`` (sequence) [*matching-items*]
365+
The object must be a Python sequence (except :class:`str`, :class:`bytes`
366+
or :class:`bytearray`) whose length is the number of format units
362367
in *items*. The C arguments must correspond to the individual format units in
363368
*items*. Format units for sequences may be nested.
364369

370+
If *items* contains format units which store a :ref:`borrowed buffer
371+
<c-arg-borrowed-buffer>` (``s``, ``s#``, ``z``, ``z#``, ``y``, or ``y#``)
372+
or a :term:`borrowed reference` (``S``, ``Y``, ``U``, ``O``, or ``O!``),
373+
the object must be a Python tuple.
374+
The *converter* for the ``O&`` format unit in *items* must not store
375+
a borrowed buffer or a borrowed reference.
376+
377+
.. versionchanged:: next
378+
:class:`str` and :class:`bytearray` objects no longer accepted as a sequence.
379+
380+
.. deprecated:: next
381+
Non-tuple sequences are deprecated if *items* contains format units
382+
which store a borrowed buffer or a borrowed reference.
383+
384+
``unit?`` (anything or ``None``) [*matching-variable(s)*]
385+
``?`` modifies the behavior of the preceding format unit.
386+
The C variable(s) corresponding to that parameter should be initialized
387+
to their default value --- when the argument is ``None``,
388+
:c:func:`PyArg_ParseTuple` does not touch the contents of the corresponding
389+
C variable(s).
390+
If the argument is not ``None``, it is parsed according to the specified
391+
format unit.
392+
393+
.. versionadded:: next
394+
365395
A few other characters have a meaning in a format string. These may not occur
366396
inside nested parentheses. They are:
367397

Doc/c-api/buffer.rst

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,19 @@ characteristic of being backed by a possibly large memory buffer. It is
2626
then desirable, in some situations, to access that buffer directly and
2727
without intermediate copying.
2828

29-
Python provides such a facility at the C level in the form of the :ref:`buffer
30-
protocol <bufferobjects>`. This protocol has two sides:
29+
Python provides such a facility at the C and Python level in the form of the
30+
:ref:`buffer protocol <bufferobjects>`. This protocol has two sides:
3131

3232
.. index:: single: PyBufferProcs (C type)
3333

3434
- on the producer side, a type can export a "buffer interface" which allows
3535
objects of that type to expose information about their underlying buffer.
36-
This interface is described in the section :ref:`buffer-structs`;
36+
This interface is described in the section :ref:`buffer-structs`; for
37+
Python see :ref:`python-buffer-protocol`.
3738

3839
- on the consumer side, several means are available to obtain a pointer to
39-
the raw underlying data of an object (for example a method parameter).
40+
the raw underlying data of an object (for example a method parameter). For
41+
Python see :class:`memoryview`.
4042

4143
Simple objects such as :class:`bytes` and :class:`bytearray` expose their
4244
underlying buffer in byte-oriented form. Other forms are possible; for example,
@@ -62,6 +64,10 @@ In both cases, :c:func:`PyBuffer_Release` must be called when the buffer
6264
isn't needed anymore. Failure to do so could lead to various issues such as
6365
resource leaks.
6466

67+
.. versionadded:: 3.12
68+
69+
The buffer protocol is now accessible in Python, see
70+
:ref:`python-buffer-protocol` and :class:`memoryview`.
6571

6672
.. _buffer-structure:
6773

Doc/c-api/monitoring.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,6 @@ would typically correspond to a python function.
205205
206206
.. versionadded:: 3.13
207207
208-
.. deprecated:: next
208+
.. deprecated:: 3.14
209209
210210
This function is :term:`soft deprecated`.

Doc/library/ctypes.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2632,7 +2632,7 @@ These are the fundamental ctypes data types:
26322632
Represents the C :c:expr:`PyObject *` datatype. Calling this without an
26332633
argument creates a ``NULL`` :c:expr:`PyObject *` pointer.
26342634

2635-
.. versionchanged:: next
2635+
.. versionchanged:: 3.14
26362636
:class:`!py_object` is now a :term:`generic type`.
26372637

26382638
The :mod:`!ctypes.wintypes` module provides quite some other Windows specific
@@ -2846,7 +2846,7 @@ fields, or any other data types containing pointer type fields.
28462846
:class:`!CField` objects are created via :attr:`~Structure._fields_`;
28472847
do not instantiate the class directly.
28482848

2849-
.. versionadded:: next
2849+
.. versionadded:: 3.14
28502850

28512851
Previously, descriptors only had ``offset`` and ``size`` attributes
28522852
and a readable string representation; the :class:`!CField` class was not

Doc/library/fnmatch.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ functions: :func:`fnmatch`, :func:`fnmatchcase`, :func:`.filter`.
9797
It is the same as ``[n for n in names if not fnmatch(n, pat)]``,
9898
but implemented more efficiently.
9999

100-
.. versionadded:: next
100+
.. versionadded:: 3.14
101101

102102

103103
.. function:: translate(pat)

Doc/library/graphlib.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@
109109
A :exc:`ValueError` will be raised if the sort has been started by
110110
:meth:`~.static_order` or :meth:`~.get_ready`.
111111

112-
.. versionchanged:: next
112+
.. versionchanged:: 3.14
113113

114114
``prepare()`` can now be called more than once as long as the sort has
115115
not started. Previously this raised :exc:`ValueError`.

Doc/library/http.server.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ handler. Code to create and run the server looks like this::
7878

7979
By default, it is set to ``["http/1.1"]``, meaning the server supports HTTP/1.1.
8080

81-
.. versionadded:: next
81+
.. versionadded:: 3.14
8282

8383
.. class:: ThreadingHTTPSServer(server_address, RequestHandlerClass,\
8484
bind_and_activate=True, *, certfile, keyfile=None,\
@@ -88,7 +88,7 @@ handler. Code to create and run the server looks like this::
8888
requests by inheriting from :class:`~socketserver.ThreadingMixIn`. This is
8989
analogous to :class:`ThreadingHTTPServer` only using :class:`HTTPSServer`.
9090

91-
.. versionadded:: next
91+
.. versionadded:: 3.14
9292

9393

9494
The :class:`HTTPServer`, :class:`ThreadingHTTPServer`, :class:`HTTPSServer` and
@@ -588,15 +588,15 @@ The following options are accepted:
588588

589589
python -m http.server --tls-cert fullchain.pem
590590

591-
.. versionadded:: next
591+
.. versionadded:: 3.14
592592

593593
.. option:: --tls-key
594594

595595
Specifies a private key file for HTTPS connections.
596596

597597
This option requires ``--tls-cert`` to be specified.
598598

599-
.. versionadded:: next
599+
.. versionadded:: 3.14
600600

601601
.. option:: --tls-password-file
602602

@@ -609,7 +609,7 @@ The following options are accepted:
609609

610610
This option requires `--tls-cert`` to be specified.
611611

612-
.. versionadded:: next
612+
.. versionadded:: 3.14
613613

614614

615615
.. _http.server-security:

Doc/library/multiprocessing.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1425,7 +1425,7 @@ object -- see :ref:`multiprocessing-managers`.
14251425

14261426
Return a boolean indicating whether this object is locked right now.
14271427

1428-
.. versionadded:: next
1428+
.. versionadded:: 3.14
14291429

14301430

14311431
.. class:: RLock()
@@ -1492,7 +1492,7 @@ object -- see :ref:`multiprocessing-managers`.
14921492

14931493
Return a boolean indicating whether this object is locked right now.
14941494

1495-
.. versionadded:: next
1495+
.. versionadded:: 3.14
14961496

14971497

14981498
.. class:: Semaphore([value])

Doc/library/pdb.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -769,7 +769,7 @@ can be overridden by the local file.
769769
When using ``pdb.pm()`` or ``Pdb.post_mortem(...)`` with a chained exception
770770
instead of a traceback, it allows the user to move between the
771771
chained exceptions using ``exceptions`` command to list exceptions, and
772-
``exception <number>`` to switch to that exception.
772+
``exceptions <number>`` to switch to that exception.
773773

774774

775775
Example::

0 commit comments

Comments
 (0)