Skip to content

Commit 4bb11a9

Browse files
Merge branch 'main' into fix_libedit
2 parents 37e6e6d + 9560e0d commit 4bb11a9

File tree

111 files changed

+2047
-833
lines changed

Some content is hidden

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

111 files changed

+2047
-833
lines changed

Doc/c-api/arg.rst

+24-2
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@ API Functions
413413
than a variable number of arguments.
414414
415415
416-
.. c:function:: int PyArg_ParseTupleAndKeywords(PyObject *args, PyObject *kw, const char *format, char *keywords[], ...)
416+
.. c:function:: int PyArg_ParseTupleAndKeywords(PyObject *args, PyObject *kw, const char *format, char * const *keywords, ...)
417417
418418
Parse the parameters of a function that takes both positional and keyword
419419
parameters into local variables.
@@ -424,15 +424,24 @@ API Functions
424424
Returns true on success; on failure, it returns false and raises the
425425
appropriate exception.
426426
427+
.. note::
428+
429+
The *keywords* parameter declaration is :c:expr:`char * const *` in C and
430+
:c:expr:`const char * const *` in C++.
431+
This can be overridden with the :c:macro:`PY_CXX_CONST` macro.
432+
427433
.. versionchanged:: 3.6
428434
Added support for :ref:`positional-only parameters
429435
<positional-only_parameter>`.
430436
431437
.. versionchanged:: 3.13
438+
The *keywords* parameter has now type :c:expr:`char * const *` in C and
439+
:c:expr:`const char * const *` in C++, instead of :c:expr:`char **`.
432440
Added support for non-ASCII keyword parameter names.
433441
434442
435-
.. c:function:: int PyArg_VaParseTupleAndKeywords(PyObject *args, PyObject *kw, const char *format, char *keywords[], va_list vargs)
443+
444+
.. c:function:: int PyArg_VaParseTupleAndKeywords(PyObject *args, PyObject *kw, const char *format, char * const *keywords, va_list vargs)
436445
437446
Identical to :c:func:`PyArg_ParseTupleAndKeywords`, except that it accepts a
438447
va_list rather than a variable number of arguments.
@@ -505,6 +514,19 @@ API Functions
505514
506515
PyArg_ParseTuple(args, "O|O:ref", &object, &callback)
507516
517+
.. c:macro:: PY_CXX_CONST
518+
519+
The value to be inserted, if any, before :c:expr:`char * const *`
520+
in the *keywords* parameter declaration of
521+
:c:func:`PyArg_ParseTupleAndKeywords` and
522+
:c:func:`PyArg_VaParseTupleAndKeywords`.
523+
Default empty for C and ``const`` for C++
524+
(:c:expr:`const char * const *`).
525+
To override, define it to the desired value before including
526+
:file:`Python.h`.
527+
528+
.. versionadded:: 3.13
529+
508530
509531
---------------
510532
Building values

Doc/c-api/hash.rst

+3
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,7 @@ See also the :c:member:`PyTypeObject.tp_hash` member.
4545
4646
Get the hash function definition.
4747
48+
.. seealso::
49+
:pep:`456` "Secure and interchangeable hash algorithm".
50+
4851
.. versionadded:: 3.4

Doc/conf.py

+10-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,13 @@
2424
'sphinx.ext.doctest',
2525
]
2626

27-
# Skip if downstream redistributors haven't installed it
27+
# Skip if downstream redistributors haven't installed them
28+
try:
29+
import notfound.extension
30+
except ImportError:
31+
pass
32+
else:
33+
extensions.append('notfound.extension')
2834
try:
2935
import sphinxext.opengraph
3036
except ImportError:
@@ -157,6 +163,9 @@
157163
('envvar', 'USER'),
158164
('envvar', 'USERNAME'),
159165
('envvar', 'USERPROFILE'),
166+
# Deprecated function that was never documented:
167+
('py:func', 'getargspec'),
168+
('py:func', 'inspect.getargspec'),
160169
]
161170

162171
# Temporary undocumented names.

Doc/extending/extending.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -735,7 +735,7 @@ Keyword Parameters for Extension Functions
735735
The :c:func:`PyArg_ParseTupleAndKeywords` function is declared as follows::
736736

737737
int PyArg_ParseTupleAndKeywords(PyObject *arg, PyObject *kwdict,
738-
const char *format, char *kwlist[], ...);
738+
const char *format, char * const *kwlist, ...);
739739

740740
The *arg* and *format* parameters are identical to those of the
741741
:c:func:`PyArg_ParseTuple` function. The *kwdict* parameter is the dictionary of

Doc/library/abc.rst

+21-21
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ The :mod:`collections` module has some concrete classes that derive from
2121
ABCs; these can, of course, be further derived. In addition, the
2222
:mod:`collections.abc` submodule has some ABCs that can be used to test whether
2323
a class or instance provides a particular interface, for example, if it is
24-
:term:`hashable` or if it is a mapping.
24+
:term:`hashable` or if it is a :term:`mapping`.
2525

2626

2727
This module provides the metaclass :class:`ABCMeta` for defining ABCs and
@@ -30,19 +30,19 @@ a helper class :class:`ABC` to alternatively define ABCs through inheritance:
3030
.. class:: ABC
3131

3232
A helper class that has :class:`ABCMeta` as its metaclass. With this class,
33-
an abstract base class can be created by simply deriving from :class:`ABC`
33+
an abstract base class can be created by simply deriving from :class:`!ABC`
3434
avoiding sometimes confusing metaclass usage, for example::
3535

3636
from abc import ABC
3737

3838
class MyABC(ABC):
3939
pass
4040

41-
Note that the type of :class:`ABC` is still :class:`ABCMeta`, therefore
42-
inheriting from :class:`ABC` requires the usual precautions regarding
41+
Note that the type of :class:`!ABC` is still :class:`ABCMeta`, therefore
42+
inheriting from :class:`!ABC` requires the usual precautions regarding
4343
metaclass usage, as multiple inheritance may lead to metaclass conflicts.
4444
One may also define an abstract base class by passing the metaclass
45-
keyword and using :class:`ABCMeta` directly, for example::
45+
keyword and using :class:`!ABCMeta` directly, for example::
4646

4747
from abc import ABCMeta
4848

@@ -65,7 +65,7 @@ a helper class :class:`ABC` to alternatively define ABCs through inheritance:
6565
implementations defined by the registering ABC be callable (not even via
6666
:func:`super`). [#]_
6767

68-
Classes created with a metaclass of :class:`ABCMeta` have the following method:
68+
Classes created with a metaclass of :class:`!ABCMeta` have the following method:
6969

7070
.. method:: register(subclass)
7171

@@ -86,7 +86,7 @@ a helper class :class:`ABC` to alternatively define ABCs through inheritance:
8686
Returns the registered subclass, to allow usage as a class decorator.
8787

8888
.. versionchanged:: 3.4
89-
To detect calls to :meth:`register`, you can use the
89+
To detect calls to :meth:`!register`, you can use the
9090
:func:`get_cache_token` function.
9191

9292
You can also override this method in an abstract base class:
@@ -96,10 +96,10 @@ a helper class :class:`ABC` to alternatively define ABCs through inheritance:
9696
(Must be defined as a class method.)
9797

9898
Check whether *subclass* is considered a subclass of this ABC. This means
99-
that you can customize the behavior of ``issubclass`` further without the
99+
that you can customize the behavior of :func:`issubclass` further without the
100100
need to call :meth:`register` on every class you want to consider a
101101
subclass of the ABC. (This class method is called from the
102-
:meth:`__subclasscheck__` method of the ABC.)
102+
:meth:`~class.__subclasscheck__` method of the ABC.)
103103

104104
This method should return ``True``, ``False`` or ``NotImplemented``. If
105105
it returns ``True``, the *subclass* is considered a subclass of this ABC.
@@ -142,7 +142,7 @@ a helper class :class:`ABC` to alternatively define ABCs through inheritance:
142142

143143
The ABC ``MyIterable`` defines the standard iterable method,
144144
:meth:`~iterator.__iter__`, as an abstract method. The implementation given
145-
here can still be called from subclasses. The :meth:`get_iterator` method
145+
here can still be called from subclasses. The :meth:`!get_iterator` method
146146
is also part of the ``MyIterable`` abstract base class, but it does not have
147147
to be overridden in non-abstract derived classes.
148148

@@ -153,34 +153,34 @@ a helper class :class:`ABC` to alternatively define ABCs through inheritance:
153153

154154
Finally, the last line makes ``Foo`` a virtual subclass of ``MyIterable``,
155155
even though it does not define an :meth:`~iterator.__iter__` method (it uses
156-
the old-style iterable protocol, defined in terms of :meth:`__len__` and
156+
the old-style iterable protocol, defined in terms of :meth:`~object.__len__` and
157157
:meth:`~object.__getitem__`). Note that this will not make ``get_iterator``
158158
available as a method of ``Foo``, so it is provided separately.
159159

160160

161161

162162

163-
The :mod:`abc` module also provides the following decorator:
163+
The :mod:`!abc` module also provides the following decorator:
164164

165165
.. decorator:: abstractmethod
166166

167167
A decorator indicating abstract methods.
168168

169169
Using this decorator requires that the class's metaclass is :class:`ABCMeta`
170170
or is derived from it. A class that has a metaclass derived from
171-
:class:`ABCMeta` cannot be instantiated unless all of its abstract methods
171+
:class:`!ABCMeta` cannot be instantiated unless all of its abstract methods
172172
and properties are overridden. The abstract methods can be called using any
173-
of the normal 'super' call mechanisms. :func:`abstractmethod` may be used
173+
of the normal 'super' call mechanisms. :func:`!abstractmethod` may be used
174174
to declare abstract methods for properties and descriptors.
175175

176176
Dynamically adding abstract methods to a class, or attempting to modify the
177177
abstraction status of a method or class once it is created, are only
178178
supported using the :func:`update_abstractmethods` function. The
179-
:func:`abstractmethod` only affects subclasses derived using regular
180-
inheritance; "virtual subclasses" registered with the ABC's :meth:`register`
181-
method are not affected.
179+
:func:`!abstractmethod` only affects subclasses derived using regular
180+
inheritance; "virtual subclasses" registered with the ABC's
181+
:meth:`~ABCMeta.register` method are not affected.
182182

183-
When :func:`abstractmethod` is applied in combination with other method
183+
When :func:`!abstractmethod` is applied in combination with other method
184184
descriptors, it should be applied as the innermost decorator, as shown in
185185
the following usage examples::
186186

@@ -216,7 +216,7 @@ The :mod:`abc` module also provides the following decorator:
216216

217217
In order to correctly interoperate with the abstract base class machinery,
218218
the descriptor must identify itself as abstract using
219-
:attr:`__isabstractmethod__`. In general, this attribute should be ``True``
219+
:attr:`!__isabstractmethod__`. In general, this attribute should be ``True``
220220
if any of the methods used to compose the descriptor are abstract. For
221221
example, Python's built-in :class:`property` does the equivalent of::
222222

@@ -236,7 +236,7 @@ The :mod:`abc` module also provides the following decorator:
236236
super-call in a framework that uses cooperative
237237
multiple-inheritance.
238238

239-
The :mod:`abc` module also supports the following legacy decorators:
239+
The :mod:`!abc` module also supports the following legacy decorators:
240240

241241
.. decorator:: abstractclassmethod
242242

@@ -323,7 +323,7 @@ The :mod:`abc` module also supports the following legacy decorators:
323323
...
324324

325325

326-
The :mod:`abc` module also provides the following functions:
326+
The :mod:`!abc` module also provides the following functions:
327327

328328
.. function:: get_cache_token()
329329

Doc/library/collections.rst

+4
Original file line numberDiff line numberDiff line change
@@ -981,6 +981,10 @@ field names, the method and attribute names start with an underscore.
981981

982982
Named tuples are also supported by generic function :func:`copy.replace`.
983983

984+
.. versionchanged:: 3.13
985+
Raise :exc:`TypeError` instead of :exc:`ValueError` for invalid
986+
keyword arguments.
987+
984988
.. attribute:: somenamedtuple._fields
985989

986990
Tuple of strings listing the field names. Useful for introspection

0 commit comments

Comments
 (0)