Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c458df4

Browse files
committed
Catch up with main
2 parents ab556e7 + f4fe65e commit c458df4

120 files changed

Lines changed: 2890 additions & 1690 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.

.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ Include/internal/pycore_ast_state.h generated
7676
Include/internal/pycore_opcode.h generated
7777
Include/internal/pycore_opcode_metadata.h generated
7878
Include/internal/pycore_*_generated.h generated
79+
Include/internal/pycore_uop_ids.h generated
7980
Include/opcode.h generated
8081
Include/opcode_ids.h generated
8182
Include/token.h generated
@@ -84,6 +85,7 @@ Lib/keyword.py generated
8485
Lib/test/levenshtein_examples.json generated
8586
Lib/test/test_stable_abi_ctypes.py generated
8687
Lib/token.py generated
88+
Misc/sbom.spdx.json generated
8789
Objects/typeslots.inc generated
8890
PC/python3dll.c generated
8991
Parser/parser.c generated

.github/workflows/posix-deps-apt.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ apt-get -yq install \
2121
libssl-dev \
2222
lzma \
2323
lzma-dev \
24+
strace \
2425
tk-dev \
2526
uuid-dev \
2627
xvfb \

Doc/c-api/function.rst

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -34,18 +34,20 @@ There are a few functions specific to Python functions.
3434
Return a new function object associated with the code object *code*. *globals*
3535
must be a dictionary with the global variables accessible to the function.
3636
37-
The function's docstring and name are retrieved from the code object. *__module__*
37+
The function's docstring and name are retrieved from the code object.
38+
:func:`~function.__module__`
3839
is retrieved from *globals*. The argument defaults, annotations and closure are
39-
set to ``NULL``. *__qualname__* is set to the same value as the code object's
40-
:attr:`~codeobject.co_qualname` field.
40+
set to ``NULL``. :attr:`~function.__qualname__` is set to the same value as
41+
the code object's :attr:`~codeobject.co_qualname` field.
4142
4243
4344
.. c:function:: PyObject* PyFunction_NewWithQualName(PyObject *code, PyObject *globals, PyObject *qualname)
4445
4546
As :c:func:`PyFunction_New`, but also allows setting the function object's
46-
``__qualname__`` attribute. *qualname* should be a unicode object or ``NULL``;
47-
if ``NULL``, the ``__qualname__`` attribute is set to the same value as the
48-
code object's :attr:`~codeobject.co_qualname` field.
47+
:attr:`~function.__qualname__` attribute.
48+
*qualname* should be a unicode object or ``NULL``;
49+
if ``NULL``, the :attr:`!__qualname__` attribute is set to the same value as
50+
the code object's :attr:`~codeobject.co_qualname` field.
4951
5052
.. versionadded:: 3.3
5153
@@ -62,11 +64,12 @@ There are a few functions specific to Python functions.
6264
6365
.. c:function:: PyObject* PyFunction_GetModule(PyObject *op)
6466
65-
Return a :term:`borrowed reference` to the *__module__* attribute of the
66-
function object *op*. It can be *NULL*.
67+
Return a :term:`borrowed reference` to the :attr:`~function.__module__`
68+
attribute of the :ref:`function object <user-defined-funcs>` *op*.
69+
It can be *NULL*.
6770
68-
This is normally a string containing the module name, but can be set to any
69-
other object by Python code.
71+
This is normally a :class:`string <str>` containing the module name,
72+
but can be set to any other object by Python code.
7073
7174
7275
.. c:function:: PyObject* PyFunction_GetDefaults(PyObject *op)

Doc/c-api/structures.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -419,15 +419,15 @@ Accessing attributes of extension types
419419
420420
The string should be static, no copy is made of it.
421421
422-
.. c:member:: Py_ssize_t offset
423-
424-
The offset in bytes that the member is located on the type’s object struct.
425-
426422
.. c:member:: int type
427423
428424
The type of the member in the C struct.
429425
See :ref:`PyMemberDef-types` for the possible values.
430426
427+
.. c:member:: Py_ssize_t offset
428+
429+
The offset in bytes that the member is located on the type’s object struct.
430+
431431
.. c:member:: int flags
432432
433433
Zero or more of the :ref:`PyMemberDef-flags`, combined using bitwise OR.

Doc/conf.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,10 @@
166166
# Deprecated function that was never documented:
167167
('py:func', 'getargspec'),
168168
('py:func', 'inspect.getargspec'),
169+
# Undocumented modules that users shouldn't have to worry about
170+
# (implementation details of `os.path`):
171+
('py:mod', 'ntpath'),
172+
('py:mod', 'posixpath'),
169173
]
170174

171175
# Temporary undocumented names.

Doc/howto/annotations.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,8 @@ on an arbitrary object ``o``:
153153
unwrap it by accessing either ``o.__wrapped__`` or ``o.func`` as
154154
appropriate, until you have found the root unwrapped function.
155155
* If ``o`` is a callable (but not a class), use
156-
``o.__globals__`` as the globals when calling :func:`eval`.
156+
:attr:`o.__globals__ <function.__globals__>` as the globals when calling
157+
:func:`eval`.
157158

158159
However, not all string values used as annotations can
159160
be successfully turned into Python values by :func:`eval`.

Doc/howto/descriptor.rst

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1342,7 +1342,8 @@ Using the non-data descriptor protocol, a pure Python version of
13421342
The :func:`functools.update_wrapper` call adds a ``__wrapped__`` attribute
13431343
that refers to the underlying function. Also it carries forward
13441344
the attributes necessary to make the wrapper look like the wrapped
1345-
function: ``__name__``, ``__qualname__``, ``__doc__``, and ``__annotations__``.
1345+
function: :attr:`~function.__name__`, :attr:`~function.__qualname__`,
1346+
:attr:`~function.__doc__`, and :attr:`~function.__annotations__`.
13461347

13471348
.. testcode::
13481349
:hide:
@@ -1522,8 +1523,9 @@ Using the non-data descriptor protocol, a pure Python version of
15221523
The :func:`functools.update_wrapper` call in ``ClassMethod`` adds a
15231524
``__wrapped__`` attribute that refers to the underlying function. Also
15241525
it carries forward the attributes necessary to make the wrapper look
1525-
like the wrapped function: ``__name__``, ``__qualname__``, ``__doc__``,
1526-
and ``__annotations__``.
1526+
like the wrapped function: :attr:`~function.__name__`,
1527+
:attr:`~function.__qualname__`, :attr:`~function.__doc__`,
1528+
and :attr:`~function.__annotations__`.
15271529

15281530

15291531
Member objects and __slots__

Doc/library/contextlib.rst

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,8 @@ Functions and classes provided:
106106

107107
This function is a :term:`decorator` that can be used to define a factory
108108
function for :keyword:`async with` statement asynchronous context managers,
109-
without needing to create a class or separate :meth:`__aenter__` and
110-
:meth:`__aexit__` methods. It must be applied to an :term:`asynchronous
109+
without needing to create a class or separate :meth:`~object.__aenter__` and
110+
:meth:`~object.__aexit__` methods. It must be applied to an :term:`asynchronous
111111
generator` function.
112112

113113
A simple example::
@@ -616,12 +616,12 @@ Functions and classes provided:
616616
asynchronous context managers, as well as having coroutines for
617617
cleanup logic.
618618

619-
The :meth:`close` method is not implemented, :meth:`aclose` must be used
619+
The :meth:`~ExitStack.close` method is not implemented; :meth:`aclose` must be used
620620
instead.
621621

622622
.. coroutinemethod:: enter_async_context(cm)
623623

624-
Similar to :meth:`enter_context` but expects an asynchronous context
624+
Similar to :meth:`ExitStack.enter_context` but expects an asynchronous context
625625
manager.
626626

627627
.. versionchanged:: 3.11
@@ -630,16 +630,16 @@ Functions and classes provided:
630630

631631
.. method:: push_async_exit(exit)
632632

633-
Similar to :meth:`push` but expects either an asynchronous context manager
633+
Similar to :meth:`ExitStack.push` but expects either an asynchronous context manager
634634
or a coroutine function.
635635

636636
.. method:: push_async_callback(callback, /, *args, **kwds)
637637

638-
Similar to :meth:`callback` but expects a coroutine function.
638+
Similar to :meth:`ExitStack.callback` but expects a coroutine function.
639639

640640
.. coroutinemethod:: aclose()
641641

642-
Similar to :meth:`close` but properly handles awaitables.
642+
Similar to :meth:`ExitStack.close` but properly handles awaitables.
643643

644644
Continuing the example for :func:`asynccontextmanager`::
645645

Doc/library/http.cookies.rst

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,17 @@ cookie value.
1818

1919
The module formerly strictly applied the parsing rules described in the
2020
:rfc:`2109` and :rfc:`2068` specifications. It has since been discovered that
21-
MSIE 3.0x doesn't follow the character rules outlined in those specs and also
22-
many current day browsers and servers have relaxed parsing rules when comes to
23-
Cookie handling. As a result, the parsing rules used are a bit less strict.
21+
MSIE 3.0x didn't follow the character rules outlined in those specs; many
22+
current-day browsers and servers have also relaxed parsing rules when it comes
23+
to cookie handling. As a result, this module now uses parsing rules that are a
24+
bit less strict than they once were.
2425

2526
The character set, :data:`string.ascii_letters`, :data:`string.digits` and
2627
``!#$%&'*+-.^_`|~:`` denote the set of valid characters allowed by this module
27-
in Cookie name (as :attr:`~Morsel.key`).
28+
in a cookie name (as :attr:`~Morsel.key`).
2829

2930
.. versionchanged:: 3.3
30-
Allowed ':' as a valid Cookie name character.
31+
Allowed ':' as a valid cookie name character.
3132

3233

3334
.. note::
@@ -54,9 +55,10 @@ in Cookie name (as :attr:`~Morsel.key`).
5455

5556
.. class:: SimpleCookie([input])
5657

57-
This class derives from :class:`BaseCookie` and overrides :meth:`value_decode`
58-
and :meth:`value_encode`. SimpleCookie supports strings as cookie values.
59-
When setting the value, SimpleCookie calls the builtin :func:`str()` to convert
58+
This class derives from :class:`BaseCookie` and overrides :meth:`~BaseCookie.value_decode`
59+
and :meth:`~BaseCookie.value_encode`. :class:`!SimpleCookie` supports
60+
strings as cookie values. When setting the value, :class:`!SimpleCookie`
61+
calls the builtin :func:`str` to convert
6062
the value to a string. Values received from HTTP are kept as strings.
6163

6264
.. seealso::
@@ -129,17 +131,17 @@ Morsel Objects
129131
Abstract a key/value pair, which has some :rfc:`2109` attributes.
130132

131133
Morsels are dictionary-like objects, whose set of keys is constant --- the valid
132-
:rfc:`2109` attributes, which are
133-
134-
* ``expires``
135-
* ``path``
136-
* ``comment``
137-
* ``domain``
138-
* ``max-age``
139-
* ``secure``
140-
* ``version``
141-
* ``httponly``
142-
* ``samesite``
134+
:rfc:`2109` attributes, which are:
135+
136+
.. attribute:: expires
137+
path
138+
comment
139+
domain
140+
max-age
141+
secure
142+
version
143+
httponly
144+
samesite
143145

144146
The attribute :attr:`httponly` specifies that the cookie is only transferred
145147
in HTTP requests, and is not accessible through JavaScript. This is intended
@@ -152,7 +154,7 @@ Morsel Objects
152154
The keys are case-insensitive and their default value is ``''``.
153155

154156
.. versionchanged:: 3.5
155-
:meth:`~Morsel.__eq__` now takes :attr:`~Morsel.key` and :attr:`~Morsel.value`
157+
:meth:`!__eq__` now takes :attr:`~Morsel.key` and :attr:`~Morsel.value`
156158
into account.
157159

158160
.. versionchanged:: 3.7

Doc/library/inspect.rst

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -492,7 +492,7 @@ attributes (see :ref:`import-mod-attrs` for module attributes):
492492
Methods implemented via descriptors that also pass one of the other tests
493493
return ``False`` from the :func:`ismethoddescriptor` test, simply because the
494494
other tests promise more -- you can, e.g., count on having the
495-
:ref:`__func__ <instance-methods>` attribute (etc) when an object passes
495+
:attr:`~method.__func__` attribute (etc) when an object passes
496496
:func:`ismethod`.
497497

498498

@@ -1225,9 +1225,10 @@ Classes and functions
12251225
* If ``obj`` is a class, ``globals`` defaults to
12261226
``sys.modules[obj.__module__].__dict__`` and ``locals`` defaults
12271227
to the ``obj`` class namespace.
1228-
* If ``obj`` is a callable, ``globals`` defaults to ``obj.__globals__``,
1228+
* If ``obj`` is a callable, ``globals`` defaults to
1229+
:attr:`obj.__globals__ <function.__globals__>`,
12291230
although if ``obj`` is a wrapped function (using
1230-
``functools.update_wrapper()``) it is first unwrapped.
1231+
:func:`functools.update_wrapper`) it is first unwrapped.
12311232

12321233
Calling ``get_annotations`` is best practice for accessing the
12331234
annotations dict of any object. See :ref:`annotations-howto` for

0 commit comments

Comments
 (0)