8000 Merge remote-tracking branch 'upstream/main' into feat/core/async-wit… · python/cpython@db1fcfc · GitHub
[go: up one dir, main page]

Skip to content

Commit db1fcfc

Browse files
committed
Merge remote-tracking branch 'upstream/main' into feat/core/async-with-suggesetions-128398
# Conflicts: # Lib/test/test_compile.py
2 parents aff8184 + c7f6535 commit db1fcfc

File tree

343 files changed

+7173
-3075
lines changed

Some content is hidden

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

343 files changed

+7173
-3075
lines changed

.azure-pipelines/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
trigger: ['main', '3.13', '3.12', '3.11', '3.10', '3.9', '3.8']
1+
trigger: ['main', '3.*']
22

33
jobs:
44
- job: Prebuild

.editorconfig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
root = true
22

3-
[*.{py,c,cpp,h,js,rst,md,yml}]
3+
[*.{py,c,cpp,h,js,rst,md,yml,yaml}]
44
trim_trailing_whitespace = true
55
insert_final_newline = true
66
indent_style = space
@@ -11,5 +11,5 @@ indent_size = 4
1111
[*.rst]
1212
indent_size = 3
1313

14-
[*.{js,yml}]
14+
[*.{js,yml,yaml}]
1515
indent_size = 2

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ Please read this comment in its entirety. It's quite important.
77
It should be in the following format:
88
99
```
10-
gh-NNNNN: Summary of the changes made
10+
gh-NNNNNN: Summary of the changes made
1111
```
1212
13-
Where: gh-NNNNN refers to the GitHub issue number.
13+
Where: gh-NNNNNN refers to the GitHub issue number.
1414
1515
Most PRs will require an issue number. Trivial changes, like fixing a typo, do not need an issue.
1616
@@ -20,11 +20,11 @@ If this is a backport PR (PR made against branches other than `main`),
2020
please ensure that the PR title is in the following format:
2121
2222
```
23-
[X.Y] <title from the original PR> (GH-NNNN)
23+
[X.Y] <title from the original PR> (GH-NNNNNN)
2424
```
2525
26-
Where: [X.Y] is the branch name, e.g. [3.6].
26+
Where: [X.Y] is the branch name, for example: [3.13].
2727
28-
GH-NNNN refers to the PR number from `main`.
28+
GH-NNNNNN refers to the PR number from `main`.
2929
3030
-->

.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/gcsupport.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ the garbage collector.
277277
278278
Type of the visitor function to be passed to :c:func:`PyUnstable_GC_VisitObjects`.
279279
*arg* is the same as the *arg* passed to ``PyUnstable_GC_VisitObjects``.
280-
Return ``0`` to continue iteration, return ``1`` to stop iteration. Other return
280+
Return ``1`` to continue iteration, return ``0`` to stop iteration. Other return
281281
values are reserved for now so behavior on returning anything else is undefined.
282282
283283
.. versionadded:: 3.12

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/c-api/typeobj.rst

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -611,7 +611,7 @@ and :c:data:`PyType_Type` effectively act as defaults.)
611611
Note that the :c:member:`~PyVarObject.ob_size` field may later be used for
612612
other purposes. For example, :py:type:`int` instances use the bits of
613613
:c:member:`~PyVarObject.ob_size` in an implementation-defined
614-
way; the underlying storage and its size should be acessed using
614+
way; the underlying storage and its size should be accessed using
615615
:c:func:`PyLong_Export`.
616616

617617
.. note::
@@ -703,10 +703,13 @@ and :c:data:`PyType_Type` effectively act as defaults.)
703703

704704
.. code-block:: c
705705
706-
static void foo_dealloc(foo_object *self) {
706+
static void
707+
foo_dealloc(PyObject *op)
708+
{
709+
foo_object *self = (foo_object *) op;
707710
PyObject_GC_UnTrack(self);
708711
Py_CLEAR(self->ref);
709-
Py_TYPE(self)->tp_free((PyObject *)self);
712+
Py_TYPE(self)->tp_free(self);
710713
}
711714
712715
Finally, if the type is heap allocated (:c:macro:`Py_TPFLAGS_HEAPTYPE`), the
@@ -717,10 +720,12 @@ and :c:data:`PyType_Type` effectively act as defaults.)
717720

718721
.. code-block:: c
719722
720-
static void foo_dealloc(foo_object *self) {
721-
PyTypeObject *tp = Py_TYPE(self);
723+
static void
724+
foo_dealloc(PyObject *op)
725+
{
726+
PyTypeObject *tp = Py_TYPE(op);
722727
// free references and buffers here
723-
tp->tp_free(self);
728+
tp->tp_free(op);
724729
Py_DECREF(tp);
725730
}
726731
@@ -1416,8 +1421,9 @@ and :c:data:`PyType_Type` effectively act as defaults.)
14161421
:mod:`!_thread` extension module::
14171422

14181423
static int
1419-
local_traverse(localobject *self, visitproc visit, void *arg)
1424+
local_traverse(PyObject *op, visitproc visit, void *arg)
14201425
{
1426+
localobject *self = (localobject *) op;
14211427
Py_VISIT(self->args);
14221428
Py_VISIT(self->kw);
14231429
Py_VISIT(self->dict);
@@ -1511,8 +1517,9 @@ and :c:data:`PyType_Type` effectively act as defaults.)
15111517
members to ``NULL``, as in the following example::
15121518

15131519
static int
1514-
local_clear(localobject *self)
1520+
local_clear(PyObject *op)
15151521
{
1522+
localobject *self = (localobject *) op;
15161523
Py_CLEAR(self->key);
15171524
Py_CLEAR(self->args);
15181525
Py_CLEAR(self->kw);

Doc/c-api/unicode.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -622,7 +622,7 @@ APIs:
622622
623623
On error, set *\*p_left* to ``NULL`` and set an exception.
624624
625-
On sucess, set *\*p_left* to a new strong reference to the result.
625+
On success, set *\*p_left* to a new strong reference to the result.
626626
627627
628628
.. c:function:: void PyUnicode_AppendAndDel(PyObject **p_left, PyObject *right)

Doc/conf.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -631,12 +631,12 @@
631631
'line_color': '#3776ab',
632632
}
633633
ogp_custom_meta_tags = [
634-
'<meta name="theme-color" content="#3776ab" />',
634+
'<meta name="theme-color" content="#3776ab">',
635635
]
636636
if 'create-social-cards' not in tags: # noqa: F821
637637
# Define a static preview image when not creating social cards
638638
ogp_image = '_static/og-image.png'
639639
ogp_custom_meta_tags += [
640-
'<meta property="og:image:width" content="200" />',
641-
'<meta property="og:image:height" content="200" />',
640+
'<meta property="og:image:width" content="200">',
641+
'<meta property="og:image:height" content="200">',
642642
]

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ Pending removal in Python 3.16
3232
* :class:`asyncio.WindowsProactorEventLoopPolicy`
3333
* :func:`asyncio.get_event_loop_policy`
3434
* :func:`asyncio.set_event_loop_policy`
35-
* :func:`asyncio.set_event_loop`
3635

3736
Users should use :func:`asyncio.run` or :class:`asyncio.Runner` with
3837
*loop_factory* to use the desired event loop implementation.

0 commit comments

Comments
 (0)
0