Skip to content

Commit b4cdbd0

Browse files
authored
Merge branch 'main' into gh-128799
2 parents 93332a5 + 9682a88 commit b4cdbd0

File tree

118 files changed

+3241
-2446
lines changed

Some content is hidden

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

118 files changed

+3241
-2446
lines changed

Doc/deprecations/c-api-pending-removal-in-3.18.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ Pending removal in Python 3.18
66
* :c:func:`!_PyBytes_Join`: use :c:func:`PyBytes_Join`.
77
* :c:func:`!_PyDict_GetItemStringWithError`: use :c:func:`PyDict_GetItemStringRef`.
88
* :c:func:`!_PyDict_Pop()`: :c:func:`PyDict_Pop`.
9+
* :c:func:`!_PyLong_Sign()`: use :c:func:`PyLong_GetSign`.
10+
* :c:func:`!_PyLong_FromDigits` and :c:func:`!_PyLong_New`:
11+
use :c:func:`PyLongWriter_Create`.
912
* :c:func:`!_PyThreadState_UncheckedGet`: use :c:func:`PyThreadState_GetUnchecked`.
1013
* :c:func:`!_PyUnicode_AsString`: use :c:func:`PyUnicode_AsUTF8`.
1114
* :c:func:`!_Py_HashPointer`: use :c:func:`Py_HashPointer`.

Doc/library/asyncio-graph.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,13 @@ and debuggers.
5959
6060
async def main():
6161
async with asyncio.TaskGroup() as g:
62-
g.create_task(test())
62+
g.create_task(test(), name='test')
6363
6464
asyncio.run(main())
6565
6666
will print::
6767

68-
* Task(name='Task-2', id=0x1039f0fe0)
68+
* Task(name='test', id=0x1039f0fe0)
6969
+ Call stack:
7070
| File 't2.py', line 4, in async test()
7171
+ Awaited by:

Doc/library/dis.rst

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,7 @@ the following command can be used to display the disassembly of
7575
>>> dis.dis(myfunc)
7676
2 RESUME 0
7777
<BLANKLINE>
78-
3 LOAD_GLOBAL 0 (len)
79-
PUSH_NULL
78+
3 LOAD_GLOBAL 1 (len + NULL)
8079
LOAD_FAST 0 (alist)
8180
CALL 1
8281
RETURN_VALUE
@@ -208,7 +207,6 @@ Example:
208207
...
209208
RESUME
210209
LOAD_GLOBAL
211-
PUSH_NULL
212210
LOAD_FAST
213211
CALL
214212
RETURN_VALUE
@@ -1217,28 +1215,21 @@ iterations of the loop.
12171215

12181216
.. opcode:: LOAD_ATTR (namei)
12191217

1220-
Replaces ``STACK[-1]`` with ``getattr(STACK[-1], co_names[namei>>1])``.
1218+
If the low bit of ``namei`` is not set, this replaces ``STACK[-1]`` with
1219+
``getattr(STACK[-1], co_names[namei>>1])``.
12211220

1222-
.. versionchanged:: 3.12
1223-
If the low bit of ``namei`` is set, then a ``NULL`` or ``self`` is
1224-
pushed to the stack before the attribute or unbound method respectively.
1225-
1226-
.. versionchanged:: 3.14
1227-
Reverted change from 3.12. The low bit of ``namei`` has no special meaning.
1228-
1229-
1230-
.. opcode:: LOAD_METHOD (namei)
1231-
1232-
Attempt to load a method named ``co_names[namei>>1]`` from the ``STACK[-1]`` object.
1233-
``STACK[-1]`` is popped.
1221+
If the low bit of ``namei`` is set, this will attempt to load a method named
1222+
``co_names[namei>>1]`` from the ``STACK[-1]`` object. ``STACK[-1]`` is popped.
12341223
This bytecode distinguishes two cases: if ``STACK[-1]`` has a method with the
12351224
correct name, the bytecode pushes the unbound method and ``STACK[-1]``.
12361225
``STACK[-1]`` will be used as the first argument (``self``) by :opcode:`CALL`
12371226
or :opcode:`CALL_KW` when calling the unbound method.
12381227
Otherwise, ``NULL`` and the object returned by
12391228
the attribute lookup are pushed.
12401229

1241-
.. versionadded:: 3.14
1230+
.. versionchanged:: 3.12
1231+
If the low bit of ``namei`` is set, then a ``NULL`` or ``self`` is
1232+
pushed to the stack before the attribute or unbound method respectively.
12421233

12431234

12441235
.. opcode:: LOAD_SUPER_ATTR (namei)
@@ -1935,6 +1926,12 @@ but are replaced by real opcodes or removed before bytecode is generated.
19351926
This opcode is now a pseudo-instruction.
19361927

19371928

1929+
.. opcode:: LOAD_METHOD
1930+
1931+
Optimized unbound method lookup. Emitted as a ``LOAD_ATTR`` opcode
1932+
with a flag set in the arg.
1933+
1934+
19381935
.. _opcode_collections:
19391936

19401937
Opcode collections

Doc/library/http.cookies.rst

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ Morsel Objects
142142
version
143143
httponly
144144
samesite
145+
partitioned
145146

146147
The attribute :attr:`httponly` specifies that the cookie is only transferred
147148
in HTTP requests, and is not accessible through JavaScript. This is intended
@@ -151,6 +152,19 @@ Morsel Objects
151152
send the cookie along with cross-site requests. This helps to mitigate CSRF
152153
attacks. Valid values for this attribute are "Strict" and "Lax".
153154

155+
The attribute :attr:`partitioned` indicates to user agents that these
156+
cross-site cookies *should* only be available in the same top-level context
157+
that the cookie was first set in. For this to be accepted by the user agent,
158+
you **must** also set ``Secure``.
159+
160+
In addition, it is recommended to use the ``__Host`` prefix when setting
161+
partitioned cookies to make them bound to the hostname and not the
162+
registrable domain. Read
163+
`CHIPS (Cookies Having Independent Partitioned State)`_
164+
for full details and examples.
165+
166+
.. _CHIPS (Cookies Having Independent Partitioned State): https://github.com/privacycg/CHIPS/blob/main/README.md
167+
154168
The keys are case-insensitive and their default value is ``''``.
155169

156170
.. versionchanged:: 3.5
@@ -165,6 +179,9 @@ Morsel Objects
165179
.. versionchanged:: 3.8
166180
Added support for the :attr:`samesite` attribute.
167181

182+
.. versionchanged:: 3.14
183+
Added support for the :attr:`partitioned` attribute.
184+
168185

169186
.. attribute:: Morsel.value
170187

Doc/license.rst

Lines changed: 57 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -11,59 +11,63 @@ History of the software
1111
=======================
1212

1313
Python was created in the early 1990s by Guido van Rossum at Stichting
14-
Mathematisch Centrum (CWI, see https://www.cwi.nl/) in the Netherlands as a
14+
Mathematisch Centrum (CWI, see https://www.cwi.nl) in the Netherlands as a
1515
successor of a language called ABC. Guido remains Python's principal author,
1616
although it includes many contributions from others.
1717

1818
In 1995, Guido continued his work on Python at the Corporation for National
19-
Research Initiatives (CNRI, see https://www.cnri.reston.va.us/) in Reston,
19+
Research Initiatives (CNRI, see https://www.cnri.reston.va.us) in Reston,
2020
Virginia where he released several versions of the software.
2121

2222
In May 2000, Guido and the Python core development team moved to BeOpen.com to
2323
form the BeOpen PythonLabs team. In October of the same year, the PythonLabs
24-
team moved to Digital Creations (now Zope Corporation; see
25-
https://www.zope.org/). In 2001, the Python Software Foundation (PSF, see
24+
team moved to Digital Creations, which became
25+
Zope Corporation. In 2001, the Python Software Foundation (PSF, see
2626
https://www.python.org/psf/) was formed, a non-profit organization created
27-
specifically to own Python-related Intellectual Property. Zope Corporation is a
27+
specifically to own Python-related Intellectual Property. Zope Corporation was a
2828
sponsoring member of the PSF.
2929

30-
All Python releases are Open Source (see https://opensource.org/ for the Open
30+
All Python releases are Open Source (see https://opensource.org for the Open
3131
Source Definition). Historically, most, but not all, Python releases have also
3232
been GPL-compatible; the table below summarizes the various releases.
3333

34-
+----------------+--------------+------------+------------+-----------------+
35-
| Release | Derived from | Year | Owner | GPL compatible? |
36-
+================+==============+============+============+=================+
37-
| 0.9.0 thru 1.2 | n/a | 1991-1995 | CWI | yes |
38-
+----------------+--------------+------------+------------+-----------------+
39-
| 1.3 thru 1.5.2 | 1.2 | 1995-1999 | CNRI | yes |
40-
+----------------+--------------+------------+------------+-----------------+
41-
| 1.6 | 1.5.2 | 2000 | CNRI | no |
42-
+----------------+--------------+------------+------------+-----------------+
43-
| 2.0 | 1.6 | 2000 | BeOpen.com | no |
44-
+----------------+--------------+------------+------------+-----------------+
45-
| 1.6.1 | 1.6 | 2001 | CNRI | no |
46-
+----------------+--------------+------------+------------+-----------------+
47-
| 2.1 | 2.0+1.6.1 | 2001 | PSF | no |
48-
+----------------+--------------+------------+------------+-----------------+
49-
| 2.0.1 | 2.0+1.6.1 | 2001 | PSF | yes |
50-
+----------------+--------------+------------+------------+-----------------+
51-
| 2.1.1 | 2.1+2.0.1 | 2001 | PSF | yes |
52-
+----------------+--------------+------------+------------+-----------------+
53-
| 2.1.2 | 2.1.1 | 2002 | PSF | yes |
54-
+----------------+--------------+------------+------------+-----------------+
55-
| 2.1.3 | 2.1.2 | 2002 | PSF | yes |
56-
+----------------+--------------+------------+------------+-----------------+
57-
| 2.2 and above | 2.1.1 | 2001-now | PSF | yes |
58-
+----------------+--------------+------------+------------+-----------------+
34+
+----------------+--------------+------------+------------+---------------------+
35+
| Release | Derived from | Year | Owner | GPL-compatible? (1) |
36+
+================+==============+============+============+=====================+
37+
| 0.9.0 thru 1.2 | n/a | 1991-1995 | CWI | yes |
38+
+----------------+--------------+------------+------------+---------------------+
39+
| 1.3 thru 1.5.2 | 1.2 | 1995-1999 | CNRI | yes |
40+
+----------------+--------------+------------+------------+---------------------+
41+
| 1.6 | 1.5.2 | 2000 | CNRI | no |
42+
+----------------+--------------+------------+------------+---------------------+
43+
| 2.0 | 1.6 | 2000 | BeOpen.com | no |
44+
+----------------+--------------+------------+------------+---------------------+
45+
| 1.6.1 | 1.6 | 2001 | CNRI | yes (2) |
46+
+----------------+--------------+------------+------------+---------------------+
47+
| 2.1 | 2.0+1.6.1 | 2001 | PSF | no |
48+
+----------------+--------------+------------+------------+---------------------+
49+
| 2.0.1 | 2.0+1.6.1 | 2001 | PSF | yes |
50+
+----------------+--------------+------------+------------+---------------------+
51+
| 2.1.1 | 2.1+2.0.1 | 2001 | PSF | yes |
52+
+----------------+--------------+------------+------------+---------------------+
53+
| 2.1.2 | 2.1.1 | 2002 | PSF | yes |
54+
+----------------+--------------+------------+------------+---------------------+
55+
| 2.1.3 | 2.1.2 | 2002 | PSF | yes |
56+
+----------------+--------------+------------+------------+---------------------+
57+
| 2.2 and above | 2.1.1 | 2001-now | PSF | yes |
58+
+----------------+--------------+------------+------------+---------------------+
5959

6060
.. note::
6161

62-
GPL-compatible doesn't mean that we're distributing Python under the GPL. All
63-
Python licenses, unlike the GPL, let you distribute a modified version without
64-
making your changes open source. The GPL-compatible licenses make it possible to
65-
combine Python with other software that is released under the GPL; the others
66-
don't.
62+
(1) GPL-compatible doesn't mean that we're distributing Python under the GPL.
63+
All Python licenses, unlike the GPL, let you distribute a modified version
64+
without making your changes open source. The GPL-compatible licenses make
65+
it possible to combine Python with other software that is released under
66+
the GPL; the others don't.
67+
68+
(2) According to Richard Stallman, 1.6.1 is not GPL-compatible, because its license
69+
has a choice of law clause. According to CNRI, however, Stallman's lawyer has
70+
told CNRI's lawyer that 1.6.1 is "not incompatible" with the GPL.
6771

6872
Thanks to the many outside volunteers who have worked under Guido's direction to
6973
make these releases possible.
@@ -73,10 +77,10 @@ Terms and conditions for accessing or otherwise using Python
7377
============================================================
7478

7579
Python software and documentation are licensed under the
76-
:ref:`PSF License Agreement <PSF-license>`.
80+
Python Software Foundation License Version 2.
7781

7882
Starting with Python 3.8.6, examples, recipes, and other code in
79-
the documentation are dual licensed under the PSF License Agreement
83+
the documentation are dual licensed under the PSF License Version 2
8084
and the :ref:`Zero-Clause BSD license <BSD0>`.
8185

8286
Some software incorporated into Python is under different licenses.
@@ -86,39 +90,38 @@ See :ref:`OtherLicenses` for an incomplete list of these licenses.
8690

8791
.. _PSF-license:
8892

89-
PSF LICENSE AGREEMENT FOR PYTHON |release|
90-
------------------------------------------
93+
PYTHON SOFTWARE FOUNDATION LICENSE VERSION 2
94+
--------------------------------------------
9195

9296
.. parsed-literal::
9397
9498
1. This LICENSE AGREEMENT is between the Python Software Foundation ("PSF"), and
95-
the Individual or Organization ("Licensee") accessing and otherwise using Python
96-
|release| software in source or binary form and its associated documentation.
99+
the Individual or Organization ("Licensee") accessing and otherwise using this
100+
software ("Python") in source or binary form and its associated documentation.
97101
98102
2. Subject to the terms and conditions of this License Agreement, PSF hereby
99103
grants Licensee a nonexclusive, royalty-free, world-wide license to reproduce,
100104
analyze, test, perform and/or display publicly, prepare derivative works,
101-
distribute, and otherwise use Python |release| alone or in any derivative
105+
distribute, and otherwise use Python alone or in any derivative
102106
version, provided, however, that PSF's License Agreement and PSF's notice of
103107
copyright, i.e., "Copyright © 2001 Python Software Foundation; All Rights
104-
Reserved" are retained in Python |release| alone or in any derivative version
108+
Reserved" are retained in Python alone or in any derivative version
105109
prepared by Licensee.
106110
107111
3. In the event Licensee prepares a derivative work that is based on or
108-
incorporates Python |release| or any part thereof, and wants to make the
112+
incorporates Python or any part thereof, and wants to make the
109113
derivative work available to others as provided herein, then Licensee hereby
110-
agrees to include in any such work a brief summary of the changes made to Python
111-
|release|.
114+
agrees to include in any such work a brief summary of the changes made to Python.
112115
113-
4. PSF is making Python |release| available to Licensee on an "AS IS" basis.
116+
4. PSF is making Python available to Licensee on an "AS IS" basis.
114117
PSF MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. BY WAY OF
115118
EXAMPLE, BUT NOT LIMITATION, PSF MAKES NO AND DISCLAIMS ANY REPRESENTATION OR
116119
WARRANTY OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE
117-
USE OF PYTHON |release| WILL NOT INFRINGE ANY THIRD PARTY RIGHTS.
120+
USE OF PYTHON WILL NOT INFRINGE ANY THIRD PARTY RIGHTS.
118121
119-
5. PSF SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF PYTHON |release|
122+
5. PSF SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF PYTHON
120123
FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS A RESULT OF
121-
MODIFYING, DISTRIBUTING, OR OTHERWISE USING PYTHON |release|, OR ANY DERIVATIVE
124+
MODIFYING, DISTRIBUTING, OR OTHERWISE USING PYTHON, OR ANY DERIVATIVE
122125
THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF.
123126
124127
6. This License Agreement will automatically terminate upon a material breach of
@@ -130,7 +133,7 @@ PSF LICENSE AGREEMENT FOR PYTHON |release|
130133
trademark sense to endorse or promote products or services of Licensee, or any
131134
third party.
132135
133-
8. By copying, installing or otherwise using Python |release|, Licensee agrees
136+
8. By copying, installing or otherwise using Python, Licensee agrees
134137
to be bound by the terms and conditions of this License Agreement.
135138
136139
@@ -205,7 +208,7 @@ CNRI LICENSE AGREEMENT FOR PYTHON 1.6.1
205208
Agreement. This Agreement together with Python 1.6.1 may be located on the
206209
internet using the following unique, persistent identifier (known as a handle):
207210
1895.22/1013. This Agreement may also be obtained from a proxy server on the
208-
internet using the following URL: http://hdl.handle.net/1895.22/1013."
211+
internet using the following URL: http://hdl.handle.net/1895.22/1013".
209212
210213
3. In the event Licensee prepares a derivative work that is based on or
211214
incorporates Python 1.6.1 or any part thereof, and wants to make the derivative
@@ -273,7 +276,7 @@ CWI LICENSE AGREEMENT FOR PYTHON 0.9.0 THROUGH 1.2
273276
274277
.. _BSD0:
275278

276-
ZERO-CLAUSE BSD LICENSE FOR CODE IN THE PYTHON |release| DOCUMENTATION
279+
ZERO-CLAUSE BSD LICENSE FOR CODE IN THE PYTHON DOCUMENTATION
277280
----------------------------------------------------------------------
278281

279282
.. parsed-literal::

Doc/tools/extensions/pyspecific.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -34,16 +34,6 @@
3434
Body.enum.converters['lowerroman'] = \
3535
Body.enum.converters['upperroman'] = lambda x: None
3636

37-
# monkey-patch the productionlist directive to allow hyphens in group names
38-
# https://github.com/sphinx-doc/sphinx/issues/11854
39-
from sphinx.domains import std
40-
41-
std.token_re = re.compile(r'`((~?[\w-]*:)?\w+)`')
42-
43-
# backport :no-index:
44-
PyModule.option_spec['no-index'] = directives.flag
45-
46-
4737
# Support for marking up and linking to bugs.python.org issues
4838

4939
def issue_role(typ, rawtext, text, lineno, inliner, options={}, content=[]):

0 commit comments

Comments
 (0)