Skip to content

Commit

Permalink
Merge branch 'main' into gh-128799
Browse files Browse the repository at this point in the history
  • Loading branch information
iritkatriel authored Jan 25, 2025
2 parents 93332a5 + 9682a88 commit b4cdbd0
Show file tree
Hide file tree
Showing 118 changed files with 3,241 additions and 2,446 deletions.
3 changes: 3 additions & 0 deletions Doc/deprecations/c-api-pending-removal-in-3.18.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ Pending removal in Python 3.18
* :c:func:`!_PyBytes_Join`: use :c:func:`PyBytes_Join`.
* :c:func:`!_PyDict_GetItemStringWithError`: use :c:func:`PyDict_GetItemStringRef`.
* :c:func:`!_PyDict_Pop()`: :c:func:`PyDict_Pop`.
* :c:func:`!_PyLong_Sign()`: use :c:func:`PyLong_GetSign`.
* :c:func:`!_PyLong_FromDigits` and :c:func:`!_PyLong_New`:
use :c:func:`PyLongWriter_Create`.
* :c:func:`!_PyThreadState_UncheckedGet`: use :c:func:`PyThreadState_GetUnchecked`.
* :c:func:`!_PyUnicode_AsString`: use :c:func:`PyUnicode_AsUTF8`.
* :c:func:`!_Py_HashPointer`: use :c:func:`Py_HashPointer`.
Expand Down
4 changes: 2 additions & 2 deletions Doc/library/asyncio-graph.rst
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,13 @@ and debuggers.
async def main():
async with asyncio.TaskGroup() as g:
g.create_task(test())
g.create_task(test(), name='test')
asyncio.run(main())
will print::

* Task(name='Task-2', id=0x1039f0fe0)
* Task(name='test', id=0x1039f0fe0)
+ Call stack:
| File 't2.py', line 4, in async test()
+ Awaited by:
Expand Down
31 changes: 14 additions & 17 deletions Doc/library/dis.rst
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,7 @@ the following command can be used to display the disassembly of
>>> dis.dis(myfunc)
2 RESUME 0
<BLANKLINE>
3 LOAD_GLOBAL 0 (len)
PUSH_NULL
3 LOAD_GLOBAL 1 (len + NULL)
LOAD_FAST 0 (alist)
CALL 1
RETURN_VALUE
Expand Down Expand Up @@ -208,7 +207,6 @@ Example:
...
RESUME
LOAD_GLOBAL
PUSH_NULL
LOAD_FAST
CALL
RETURN_VALUE
Expand Down Expand Up @@ -1217,28 +1215,21 @@ iterations of the loop.

.. opcode:: LOAD_ATTR (namei)

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

.. versionchanged:: 3.12
If the low bit of ``namei`` is set, then a ``NULL`` or ``self`` is
pushed to the stack before the attribute or unbound method respectively.

.. versionchanged:: 3.14
Reverted change from 3.12. The low bit of ``namei`` has no special meaning.


.. opcode:: LOAD_METHOD (namei)

Attempt to load a method named ``co_names[namei>>1]`` from the ``STACK[-1]`` object.
``STACK[-1]`` is popped.
If the low bit of ``namei`` is set, this will attempt to load a method named
``co_names[namei>>1]`` from the ``STACK[-1]`` object. ``STACK[-1]`` is popped.
This bytecode distinguishes two cases: if ``STACK[-1]`` has a method with the
correct name, the bytecode pushes the unbound method and ``STACK[-1]``.
``STACK[-1]`` will be used as the first argument (``self``) by :opcode:`CALL`
or :opcode:`CALL_KW` when calling the unbound method.
Otherwise, ``NULL`` and the object returned by
the attribute lookup are pushed.

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


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


.. opcode:: LOAD_METHOD

Optimized unbound method lookup. Emitted as a ``LOAD_ATTR`` opcode
with a flag set in the arg.


.. _opcode_collections:

Opcode collections
Expand Down
17 changes: 17 additions & 0 deletions Doc/library/http.cookies.rst
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ Morsel Objects
version
httponly
samesite
partitioned

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

The attribute :attr:`partitioned` indicates to user agents that these
cross-site cookies *should* only be available in the same top-level context
that the cookie was first set in. For this to be accepted by the user agent,
you **must** also set ``Secure``.

In addition, it is recommended to use the ``__Host`` prefix when setting
partitioned cookies to make them bound to the hostname and not the
registrable domain. Read
`CHIPS (Cookies Having Independent Partitioned State)`_
for full details and examples.

.. _CHIPS (Cookies Having Independent Partitioned State): https://github.com/privacycg/CHIPS/blob/main/README.md

The keys are case-insensitive and their default value is ``''``.

.. versionchanged:: 3.5
Expand All @@ -165,6 +179,9 @@ Morsel Objects
.. versionchanged:: 3.8
Added support for the :attr:`samesite` attribute.

.. versionchanged:: 3.14
Added support for the :attr:`partitioned` attribute.


.. attribute:: Morsel.value

Expand Down
111 changes: 57 additions & 54 deletions Doc/license.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,59 +11,63 @@ History of the software
=======================

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

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

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

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

+----------------+--------------+------------+------------+-----------------+
| Release | Derived from | Year | Owner | GPL compatible? |
+================+==============+============+============+=================+
| 0.9.0 thru 1.2 | n/a | 1991-1995 | CWI | yes |
+----------------+--------------+------------+------------+-----------------+
| 1.3 thru 1.5.2 | 1.2 | 1995-1999 | CNRI | yes |
+----------------+--------------+------------+------------+-----------------+
| 1.6 | 1.5.2 | 2000 | CNRI | no |
+----------------+--------------+------------+------------+-----------------+
| 2.0 | 1.6 | 2000 | BeOpen.com | no |
+----------------+--------------+------------+------------+-----------------+
| 1.6.1 | 1.6 | 2001 | CNRI | no |
+----------------+--------------+------------+------------+-----------------+
| 2.1 | 2.0+1.6.1 | 2001 | PSF | no |
+----------------+--------------+------------+------------+-----------------+
| 2.0.1 | 2.0+1.6.1 | 2001 | PSF | yes |
+----------------+--------------+------------+------------+-----------------+
| 2.1.1 | 2.1+2.0.1 | 2001 | PSF | yes |
+----------------+--------------+------------+------------+-----------------+
| 2.1.2 | 2.1.1 | 2002 | PSF | yes |
+----------------+--------------+------------+------------+-----------------+
| 2.1.3 | 2.1.2 | 2002 | PSF | yes |
+----------------+--------------+------------+------------+-----------------+
| 2.2 and above | 2.1.1 | 2001-now | PSF | yes |
+----------------+--------------+------------+------------+-----------------+
+----------------+--------------+------------+------------+---------------------+
| Release | Derived from | Year | Owner | GPL-compatible? (1) |
+================+==============+============+============+=====================+
| 0.9.0 thru 1.2 | n/a | 1991-1995 | CWI | yes |
+----------------+--------------+------------+------------+---------------------+
| 1.3 thru 1.5.2 | 1.2 | 1995-1999 | CNRI | yes |
+----------------+--------------+------------+------------+---------------------+
| 1.6 | 1.5.2 | 2000 | CNRI | no |
+----------------+--------------+------------+------------+---------------------+
| 2.0 | 1.6 | 2000 | BeOpen.com | no |
+----------------+--------------+------------+------------+---------------------+
| 1.6.1 | 1.6 | 2001 | CNRI | yes (2) |
+----------------+--------------+------------+------------+---------------------+
| 2.1 | 2.0+1.6.1 | 2001 | PSF | no |
+----------------+--------------+------------+------------+---------------------+
| 2.0.1 | 2.0+1.6.1 | 2001 | PSF | yes |
+----------------+--------------+------------+------------+---------------------+
| 2.1.1 | 2.1+2.0.1 | 2001 | PSF | yes |
+----------------+--------------+------------+------------+---------------------+
| 2.1.2 | 2.1.1 | 2002 | PSF | yes |
+----------------+--------------+------------+------------+---------------------+
| 2.1.3 | 2.1.2 | 2002 | PSF | yes |
+----------------+--------------+------------+------------+---------------------+
| 2.2 and above | 2.1.1 | 2001-now | PSF | yes |
+----------------+--------------+------------+------------+---------------------+

.. note::

GPL-compatible doesn't mean that we're distributing Python under the GPL. All
Python licenses, unlike the GPL, let you distribute a modified version without
making your changes open source. The GPL-compatible licenses make it possible to
combine Python with other software that is released under the GPL; the others
don't.
(1) GPL-compatible doesn't mean that we're distributing Python under the GPL.
All Python licenses, unlike the GPL, let you distribute a modified version
without making your changes open source. The GPL-compatible licenses make
it possible to combine Python with other software that is released under
the GPL; the others don't.

(2) According to Richard Stallman, 1.6.1 is not GPL-compatible, because its license
has a choice of law clause. According to CNRI, however, Stallman's lawyer has
told CNRI's lawyer that 1.6.1 is "not incompatible" with the GPL.

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

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

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

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

.. _PSF-license:

PSF LICENSE AGREEMENT FOR PYTHON |release|
------------------------------------------
PYTHON SOFTWARE FOUNDATION LICENSE VERSION 2
--------------------------------------------

.. parsed-literal::
1. This LICENSE AGREEMENT is between the Python Software Foundation ("PSF"), and
the Individual or Organization ("Licensee") accessing and otherwise using Python
|release| software in source or binary form and its associated documentation.
the Individual or Organization ("Licensee") accessing and otherwise using this
software ("Python") in source or binary form and its associated documentation.
2. Subject to the terms and conditions of this License Agreement, PSF hereby
grants Licensee a nonexclusive, royalty-free, world-wide license to reproduce,
analyze, test, perform and/or display publicly, prepare derivative works,
distribute, and otherwise use Python |release| alone or in any derivative
distribute, and otherwise use Python alone or in any derivative
version, provided, however, that PSF's License Agreement and PSF's notice of
copyright, i.e., "Copyright © 2001 Python Software Foundation; All Rights
Reserved" are retained in Python |release| alone or in any derivative version
Reserved" are retained in Python alone or in any derivative version
prepared by Licensee.
3. In the event Licensee prepares a derivative work that is based on or
incorporates Python |release| or any part thereof, and wants to make the
incorporates Python or any part thereof, and wants to make the
derivative work available to others as provided herein, then Licensee hereby
agrees to include in any such work a brief summary of the changes made to Python
|release|.
agrees to include in any such work a brief summary of the changes made to Python.
4. PSF is making Python |release| available to Licensee on an "AS IS" basis.
4. PSF is making Python available to Licensee on an "AS IS" basis.
PSF MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. BY WAY OF
EXAMPLE, BUT NOT LIMITATION, PSF MAKES NO AND DISCLAIMS ANY REPRESENTATION OR
WARRANTY OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE
USE OF PYTHON |release| WILL NOT INFRINGE ANY THIRD PARTY RIGHTS.
USE OF PYTHON WILL NOT INFRINGE ANY THIRD PARTY RIGHTS.
5. PSF SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF PYTHON |release|
5. PSF SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF PYTHON
FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS A RESULT OF
MODIFYING, DISTRIBUTING, OR OTHERWISE USING PYTHON |release|, OR ANY DERIVATIVE
MODIFYING, DISTRIBUTING, OR OTHERWISE USING PYTHON, OR ANY DERIVATIVE
THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF.
6. This License Agreement will automatically terminate upon a material breach of
Expand All @@ -130,7 +133,7 @@ PSF LICENSE AGREEMENT FOR PYTHON |release|
trademark sense to endorse or promote products or services of Licensee, or any
third party.
8. By copying, installing or otherwise using Python |release|, Licensee agrees
8. By copying, installing or otherwise using Python, Licensee agrees
to be bound by the terms and conditions of this License Agreement.
Expand Down Expand Up @@ -205,7 +208,7 @@ CNRI LICENSE AGREEMENT FOR PYTHON 1.6.1
Agreement. This Agreement together with Python 1.6.1 may be located on the
internet using the following unique, persistent identifier (known as a handle):
1895.22/1013. This Agreement may also be obtained from a proxy server on the
internet using the following URL: http://hdl.handle.net/1895.22/1013."
internet using the following URL: http://hdl.handle.net/1895.22/1013".
3. In the event Licensee prepares a derivative work that is based on or
incorporates Python 1.6.1 or any part thereof, and wants to make the derivative
Expand Down Expand Up @@ -273,7 +276,7 @@ CWI LICENSE AGREEMENT FOR PYTHON 0.9.0 THROUGH 1.2
.. _BSD0:

ZERO-CLAUSE BSD LICENSE FOR CODE IN THE PYTHON |release| DOCUMENTATION
ZERO-CLAUSE BSD LICENSE FOR CODE IN THE PYTHON DOCUMENTATION
----------------------------------------------------------------------

.. parsed-literal::
Expand Down
10 changes: 0 additions & 10 deletions Doc/tools/extensions/pyspecific.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,6 @@
Body.enum.converters['lowerroman'] = \
Body.enum.converters['upperroman'] = lambda x: None

# monkey-patch the productionlist directive to allow hyphens in group names
# https://github.com/sphinx-doc/sphinx/issues/11854
from sphinx.domains import std

std.token_re = re.compile(r'`((~?[\w-]*:)?\w+)`')

# backport :no-index:
PyModule.option_spec['no-index'] = directives.flag


# Support for marking up and linking to bugs.python.org issues

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

0 comments on commit b4cdbd0

Please sign in to comment.