Skip to content

Commit 61366fd

Browse files
committed
Merge remote-tracking branch 'upstream/master' into patch-1
2 parents de50b41 + 02a1603 commit 61366fd

628 files changed

Lines changed: 13959 additions & 6558 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.

.travis.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,7 @@ matrix:
5151
env: TESTING=docs
5252
before_script:
5353
- cd Doc
54-
# Sphinx is pinned so that new versions that introduce new warnings won't suddenly cause build failures.
55-
# (Updating the version is fine as long as no warnings are raised by doing so.)
56-
# The theme used by the docs is stored separately, so we need to install that as well.
57-
- python -m pip install sphinx==2.2.0 blurb python-docs-theme
54+
- make venv PYTHON=python
5855
script:
5956
- make check suspicious html SPHINXOPTS="-q -W -j4"
6057
- name: "Documentation tests"

Doc/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ clean:
143143
venv:
144144
$(PYTHON) -m venv $(VENVDIR)
145145
$(VENVDIR)/bin/python3 -m pip install -U pip setuptools
146-
$(VENVDIR)/bin/python3 -m pip install -U Sphinx==2.3.1 blurb python-docs-theme
146+
$(VENVDIR)/bin/python3 -m pip install -r requirements.txt
147147
@echo "The venv has been created in the $(VENVDIR) directory"
148148

149149
dist:

Doc/c-api/codec.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,14 @@ Codec registry and support functions
1010
As side effect, this tries to load the :mod:`encodings` package, if not yet
1111
done, to make sure that it is always first in the list of search functions.
1212
13+
.. c:function:: int PyCodec_Unregister(PyObject *search_function)
14+
15+
Unregister a codec search function and clear the registry's cache.
16+
If the search function is not registered, do nothing.
17+
Return 0 on success. Raise an exception and return -1 on error.
18+
19+
.. versionadded:: 3.10
20+
1321
.. c:function:: int PyCodec_KnownEncoding(const char *encoding)
1422
1523
Return ``1`` or ``0`` depending on whether there is a registered codec for

Doc/c-api/datetime.rst

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,11 @@ must not be ``NULL``, and the type is not checked:
185185
186186
Return the microsecond, as an int from 0 through 999999.
187187
188+
.. c:function:: PyObject* PyDateTime_DATE_GET_TZINFO(PyDateTime_DateTime *o)
189+
190+
Return the tzinfo (which may be ``None``).
191+
192+
.. versionadded:: 3.10
188193
189194
Macros to extract fields from time objects. The argument must be an instance of
190195
:c:data:`PyDateTime_Time`, including subclasses. The argument must not be ``NULL``,
@@ -209,6 +214,12 @@ and the type is not checked:
209214
210215
Return the microsecond, as an int from 0 through 999999.
211216
217+
.. c:function:: PyObject* PyDateTime_TIME_GET_TZINFO(PyDateTime_Time *o)
218+
219+
Return the tzinfo (which may be ``None``).
220+
221+
.. versionadded:: 3.10
222+
212223
213224
Macros to extract fields from time delta objects. The argument must be an
214225
instance of :c:data:`PyDateTime_Delta`, including subclasses. The argument must

Doc/c-api/dict.rst

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,14 +81,16 @@ Dictionary Objects
8181
.. c:function:: int PyDict_DelItem(PyObject *p, PyObject *key)
8282
8383
Remove the entry in dictionary *p* with key *key*. *key* must be hashable;
84-
if it isn't, :exc:`TypeError` is raised. Return ``0`` on success or ``-1``
85-
on failure.
84+
if it isn't, :exc:`TypeError` is raised.
85+
If *key* is not in the dictionary, :exc:`KeyError` is raised.
86+
Return ``0`` on success or ``-1`` on failure.
8687
8788
8889
.. c:function:: int PyDict_DelItemString(PyObject *p, const char *key)
8990
90-
Remove the entry in dictionary *p* which has a key specified by the string
91-
*key*. Return ``0`` on success or ``-1`` on failure.
91+
Remove the entry in dictionary *p* which has a key specified by the string *key*.
92+
If *key* is not in the dictionary, :exc:`KeyError` is raised.
93+
Return ``0`` on success or ``-1`` on failure.
9294
9395
9496
.. c:function:: PyObject* PyDict_GetItem(PyObject *p, PyObject *key)

Doc/c-api/gen.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,13 @@ than explicitly calling :c:func:`PyGen_New` or :c:func:`PyGen_NewWithQualName`.
4242
with ``__name__`` and ``__qualname__`` set to *name* and *qualname*.
4343
A reference to *frame* is stolen by this function. The *frame* argument
4444
must not be ``NULL``.
45+
46+
.. c:function:: PySendResult PyGen_Send(PyGenObject *gen, PyObject *arg, PyObject **presult)
47+
48+
Sends the *arg* value into the generator *gen*. Coroutine objects
49+
are also allowed to be as the *gen* argument but they need to be
50+
explicitly casted to PyGenObject*. Returns:
51+
52+
- ``PYGEN_RETURN`` if generator returns. Return value is returned via *presult*.
53+
- ``PYGEN_NEXT`` if generator yields. Yielded value is returned via *presult*.
54+
- ``PYGEN_ERROR`` if generator has raised and exception. *presult* is set to ``NULL``.

Doc/c-api/iter.rst

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,17 @@ something like this::
4444
else {
4545
/* continue doing useful work */
4646
}
47+
48+
49+
.. c:type:: PySendResult
50+
51+
The enum value used to represent different results of :c:func:`PyIter_Send`.
52+
53+
54+
.. c:function:: PySendResult PyIter_Send(PyObject *iter, PyObject *arg, PyObject **presult)
55+
56+
Sends the *arg* value into the iterator *iter*. Returns:
57+
58+
- ``PYGEN_RETURN`` if iterator returns. Return value is returned via *presult*.
59+
- ``PYGEN_NEXT`` if iterator yields. Yielded value is returned via *presult*.
60+
- ``PYGEN_ERROR`` if iterator has raised and exception. *presult* is set to ``NULL``.

Doc/c-api/type.rst

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,13 @@ Type Objects
117117
If no module is associated with the given type, sets :py:class:`TypeError`
118118
and returns ``NULL``.
119119
120+
This function is usually used to get the module in which a method is defined.
121+
Note that in such a method, ``PyType_GetModule(Py_TYPE(self))``
122+
may not return the intended result.
123+
``Py_TYPE(self)`` may be a *subclass* of the intended class, and subclasses
124+
are not necessarily defined in the same module as their superclass.
125+
See :c:type:`PyCMethod` to get the class that defines the method.
126+
120127
.. versionadded:: 3.9
121128
122129
.. c:function:: void* PyType_GetModuleState(PyTypeObject *type)
@@ -151,9 +158,12 @@ The following functions and structs are used to create
151158
If *bases* is ``NULL``, the *Py_tp_base* slot is used instead.
152159
If that also is ``NULL``, the new type derives from :class:`object`.
153160
154-
The *module* must be a module object or ``NULL``.
161+
The *module* argument can be used to record the module in which the new
162+
class is defined. It must be a module object or ``NULL``.
155163
If not ``NULL``, the module is associated with the new type and can later be
156164
retreived with :c:func:`PyType_GetModule`.
165+
The associated module is not inherited by subclasses; it must be specified
166+
for each class individually.
157167
158168
This function calls :c:func:`PyType_Ready` on the new type.
159169
@@ -215,7 +225,8 @@ The following functions and structs are used to create
215225
* ``Py_nb_add`` to set :c:member:`PyNumberMethods.nb_add`
216226
* ``Py_sq_length`` to set :c:member:`PySequenceMethods.sq_length`
217227
218-
The following fields cannot be set using :c:type:`PyType_Spec` and :c:type:`PyType_Slot`:
228+
The following fields cannot be set at all using :c:type:`PyType_Spec` and
229+
:c:type:`PyType_Slot`:
219230
220231
* :c:member:`~PyTypeObject.tp_dict`
221232
* :c:member:`~PyTypeObject.tp_mro`
@@ -229,13 +240,21 @@ The following functions and structs are used to create
229240
(see :ref:`PyMemberDef <pymemberdef-offsets>`)
230241
* :c:member:`~PyTypeObject.tp_vectorcall_offset`
231242
(see :ref:`PyMemberDef <pymemberdef-offsets>`)
243+
244+
The following fields cannot be set using :c:type:`PyType_Spec` and
245+
:c:type:`PyType_Slot` under the limited API:
246+
232247
* :c:member:`~PyBufferProcs.bf_getbuffer`
233248
* :c:member:`~PyBufferProcs.bf_releasebuffer`
234249
235250
Setting :c:data:`Py_tp_bases` may be problematic on some platforms.
236251
To avoid issues, use the *bases* argument of
237252
:py:func:`PyType_FromSpecWithBases` instead.
238253
254+
.. versionchanged:: 3.9
255+
256+
Slots in :c:type:`PyBufferProcs` in may be set in the unlimited API.
257+
239258
.. c:member:: void *PyType_Slot.pfunc
240259
241260
The desired value of the slot. In most cases, this is a pointer

Doc/data/refcounts.dat

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -959,6 +959,11 @@ PyGen_NewWithQualName:PyFrameObject*:frame:0:
959959
PyGen_NewWithQualName:PyObject*:name:0:
960960
PyGen_NewWithQualName:PyObject*:qualname:0:
961961

962+
PyGen_Send:int:::
963+
PyGen_Send:PyGenObject*:gen:0:
964+
PyGen_Send:PyObject*:arg:0:
965+
PyGen_Send:PyObject**:presult:+1:
966+
962967
PyCoro_CheckExact:int:::
963968
PyCoro_CheckExact:PyObject*:ob:0:
964969

@@ -1076,6 +1081,11 @@ PyIter_Check:PyObject*:o:0:
10761081
PyIter_Next:PyObject*::+1:
10771082
PyIter_Next:PyObject*:o:0:
10781083

1084+
PyIter_Send:int:::
1085+
PyIter_Send:PyObject*:iter:0:
1086+
PyIter_Send:PyObject*:arg:0:
1087+
PyIter_Send:PyObject**:presult:+1:
1088+
10791089
PyList_Append:int:::
10801090
PyList_Append:PyObject*:list:0:
10811091
PyList_Append:PyObject*:item:+1:
@@ -2283,6 +2293,11 @@ PyType_CheckExact:PyObject*:o:0:
22832293
PyType_FromSpec:PyObject*::+1:
22842294
PyType_FromSpec:PyType_Spec*:spec::
22852295

2296+
PyType_FromModuleAndSpec:PyObject*::+1:
2297+
PyType_FromModuleAndSpec:PyObject*:module:+1:
2298+
PyType_FromModuleAndSpec:PyType_Spec*:spec::
2299+
PyType_FromModuleAndSpec:PyObject*:bases:0:
2300+
22862301
PyType_FromSpecWithBases:PyObject*::+1:
22872302
PyType_FromSpecWithBases:PyType_Spec*:spec::
22882303
PyType_FromSpecWithBases:PyObject*:bases:0:

Doc/extending/newtypes_tutorial.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,7 @@ But this would be risky. Our type doesn't restrict the type of the
416416
``first`` member, so it could be any kind of object. It could have a
417417
destructor that causes code to be executed that tries to access the
418418
``first`` member; or that destructor could release the
419-
:term:`Global interpreter Lock` and let arbitrary code run in other
419+
:term:`Global interpreter Lock <GIL>` and let arbitrary code run in other
420420
threads that accesses and modifies our object.
421421

422422
To be paranoid and protect ourselves against this possibility, we almost

0 commit comments

Comments
 (0)