8000 Merge remote-tracking branch 'upstream/master' into warn · python/cpython@497298c · GitHub
[go: up one dir, main page]

Skip to content

Commit 497298c

Browse files
committed
Merge remote-tracking branch 'upstream/master' into warn
2 parents b2ebe5c + 526e23f commit 497298c

File tree

168 files changed

+5469
-3489
lines changed

Some content is hidden

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

168 files changed

+5469
-3489
lines changed

.github/CONTRIBUTING.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,17 @@ Build Status
88

99
+ `Stable buildbots <http://buildbot.python.org/3.x.stable/>`_
1010

11-
- 3.7
11+
- 3.9
1212

13-
+ `Stable buildbots <http://buildbot.python.org/3.7.stable/>`_
13+
+ `Stable buildbots <http://buildbot.python.org/3.9.stable/>`_
1414

15-
- 3.6
15+
- 3.8
1616

17-
+ `Stable buildbots <http://buildbot.python.org/3.6.stable/>`_
17+
+ `Stable buildbots <http://buildbot.python.org/3.8.stable/>`_
1818

19-
- 2.7
19+
- 3.7
2020

21-
+ `Stable buildbots <http://buildbot.python.org/2.7.stable/>`_
21+
+ `Stable buildbots <http://buildbot.python.org/3.7.stable/>`_
2222

2323

2424
Thank You

.github/problem-matchers/sphinx.json

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
{
2+
"problemMatcher": [
3+
{
4+
"owner": "sphinx-problem-matcher",
5+
"pattern": [
6+
{
7+
"regexp": "^(.*):(\\d+):\\s+(\\w*):\\s+(.*)$",
8+
"file": 1,
9+
"line": 2,
10+
"severity": 3,
11+
"message": 4
12+
}
13+
]
14+
},
15+
{
16+
"owner": "sphinx-problem-matcher-loose",
17+
"pattern": [
18+
{
19+
"_comment": "A bit of a looser pattern, doesn't look for line numbers, just looks for file names relying on them to start with / and end with .rst",
20+
"regexp": "(\/.*\\.rst):\\s+(\\w*):\\s+(.*)$",
21+
"file": 1,
22+
"severity": 2,
23+
"message": 3
24+
}
25+
]
26+
},
27+
{
28+
"owner": "sphinx-problem-matcher-loose-no-severity",
29+
"pattern": [
30+
{
31+
"_comment": "Looks for file names ending with .rst and line numbers but without severity",
32+
"regexp": "^(.*\\.rst):(\\d+):(.*)$",
33+
"file": 1,
34+
"line": 2,
35+
"message": 3
36+
}
37+
]
38+
}
39+
]
40+
}

.github/workflows/doc.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ jobs:
2525
runs-on: ubuntu-latest
2626
steps:
2727
- uses: actions/checkout@v2
28+
- name: Register Sphinx problem matcher
29+
run: echo "::add-matcher::.github/problem-matchers/sphinx.json"
2830
- name: 'Install Dependencies'
2931
run: sudo ./.github/workflows/posix-deps-ap B41A t.sh && sudo apt-get install wamerican
3032
- name: 'Configure CPython'
@@ -34,7 +36,7 @@ jobs:
3436
- name: 'Install build dependencies'
3537
run: make -C Doc/ PYTHON=../python venv
3638
- name: 'Build documentation'
37-
run: xvfb-run make -C Doc/ PYTHON=../python SPHINXOPTS="-q -W -j4" doctest suspicious html
39+
run: xvfb-run make -C Doc/ PYTHON=../python SPHINXOPTS="-q -W --keep-going -j4" doctest suspicious html
3840
- name: 'Upload'
3941
uses: actions/upload-artifact@v1
4042
with:

Doc/c-api/call.rst

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ Vectorcall Support API
144144
However, the function ``PyVectorcall_NARGS`` should be used to allow
145145
for future extensions.
146146
147-
This function is not part of the `limited API <stable>`_.
147+
This function is not part of the :ref:`limited API <stable>`.
148148
149149
.. versionadded:: 3.8
150150
@@ -158,7 +158,7 @@ Vectorcall Support API
158158
This is mostly useful to check whether or not *op* supports vectorcall,
159159
which can be done by checking ``PyVectorcall_Function(op) != NULL``.
160160
161-
This function is not part of the `limited API <stable>`_.
161+
This function is not part of the :ref:`limited API <stable>`.
162162
163163
.. versionadded:: 3.8
164164
@@ -172,7 +172,7 @@ Vectorcall Support API
172172
It does not check the :const:`Py_TPFLAGS_HAVE_VECTORCALL` flag
173173
and it does not fall back to ``tp_call``.
174174
175-
This function is not part of the `limited API <stable>`_.
175+
This function is not part of the :ref:`limited API <stable>`.
176176
177177
.. versionadded:: 3.8
178178
@@ -256,7 +256,7 @@ please see individual documentation for details.
256256
Return the result of the call on success, or raise an exception and return
257257
*NULL* on failure.
258258
259-
This function is not part of the `limited API <stable>`_.
259+
This function is not part of the :ref:`limited API <stable>`.
260260
261261
.. versionadded:: 3.9
262262
@@ -343,7 +343,7 @@ please see individual documentation for details.
343343
Return the result of the call on success, or raise an exception and return
344344
*NULL* on failure.
345345
346-
This function is not part of the `limited API <stable>`_.
346+
This function is not part of the :ref:`limited API <stable>`.
347347
348348
.. versionadded:: 3.9
349349
@@ -357,7 +357,7 @@ please see individual documentation for details.
357357
Return the result of the call on success, or raise an exception and return
358358
*NULL* on failure.
359359
360-
This function is not part of the `limited API <stable>`_.
360+
This function is not part of the :ref:`limited API <stable>`.
361361
362362
.. versionadded:: 3.9
363363
@@ -372,7 +372,7 @@ please see individual documentation for details.
372372
Return the result of the call on success, or raise an exception and return
373373
*NULL* on failure.
374374
375-
This function is not part of the `limited API <stable>`_.
375+
This function is not part of the :ref:`limited API <stable>`.
376376
377377
.. versionadded:: 3.9
378378
@@ -388,7 +388,7 @@ please see individual documentation for details.
388388
already has a dictionary ready to use for the keyword arguments,
389389
but not a tuple for the positional arguments.
390390
391-
This function is not part of the `limited API <stable>`_.
391+
This function is not part of the :ref:`limited API <stable>`.
392392
393393
.. versionadded:: 3.9
394394
@@ -410,7 +410,7 @@ please see individual documentation for details.
410410
Return the result of the call on success, or raise an exception and return
411411
*NULL* on failure.
412412
413-
This function is not part of the `limited API <stable>`_.
413+
This function is not part of the :ref:`limited API <stable>`.
414414
415415
.. versionadded:: 3.9
416416

Doc/c-api/long.rst

Lines changed: 25 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -129,9 +129,8 @@ distinguished from a number. Use :c:func:`PyErr_Occurred` to disambiguate.
129129
single: OverflowError (built-in exception)
130130
131131
Return a C :c:type:`long` representation of *obj*. If *obj* is not an
132-
instance of :c:type:`PyLongObject`, first call its :meth:`__index__` or
133-
:meth:`__int__` method (if present) to convert it to a
134-
:c:type:`PyLongObject`.
132+
instance of :c:type:`PyLongObject`, first call its :meth:`__index__` method
133+
(if present) to convert it to a :c:type:`PyLongObject`.
135134
136135
Raise :exc:`OverflowError` if the value of *obj* is out of range for a
137136
:c:type:`long`.
@@ -141,16 +140,15 @@ distinguished from a number. Use :c:func:`PyErr_Occurred` to disambiguate.
141140
.. versionchanged:: 3.8
142141
Use :meth:`__index__` if available.
143142
144-
.. deprecated:: 3.8
145-
Using :meth:`__int__` is deprecated.
143+
.. versionchanged:: 3.10
144+
This function will no longer use :meth:`__int__`.
146145
147146
148147
.. c:function:: long PyLong_AsLongAndOverflow(PyObject *obj, int *overflow)
149148
150149
Return a C :c:type:`long` representation of *obj*. If *obj* is not an
151-
instance of :c:type:`PyLongObject`, first call its :meth:`__index__` or
152-
:meth:`__int__` method (if present) to convert it to a
153-
:c:type:`PyLongObject`.
150+
instance of :c:type:`PyLongObject`, first call its :meth:`__index__`
151+
method (if present) to convert it to a :c:type:`PyLongObject`.
154152
155153
If the value of *obj* is greater than :const:`LONG_MAX` or less than
156154
:const:`LONG_MIN`, set *\*overflow* to ``1`` or ``-1``, respectively, and
@@ -162,8 +160,8 @@ distinguished from a number. Use :c:func:`PyErr_Occurred` to disambiguate.
162160
.. versionchanged:: 3.8
163161
Use :meth:`__index__` if available.
164162
165-
.. deprecated:: 3.8
166-
Using :meth:`__int__` is deprecated.
163+
.. versionchanged:: 3.10
164+
This function will no longer use :meth:`__int__`.
167165
168166
169167
.. c:function:: long long PyLong_AsLongLong(PyObject *obj)
@@ -172,9 +170,8 @@ distinguished from a number. Use :c:func:`PyErr_Occurred` to disambiguate.
172170
single: OverflowError (built-in exception)
173171
174172
Return a C :c:type:`long long` representation of *obj*. If *obj* is not an
175-
instance of :c:type:`PyLongObject`, first call its :meth:`__index__` or
176-
:meth:`__int__` method (if present) to convert it to a
177-
:c:type:`PyLongObject`.
173+
instance of :c:type:`PyLongObject`, first call its :meth:`__index__` method
174+
(if present) to convert it to a :c:type:`PyLongObject`.
178175
179176
Raise :exc:`OverflowError` if the value of *obj* is out of range for a
180177
:c:type:`long long`.
@@ -184,16 +181,15 @@ distinguished from a number. Use :c:func:`PyErr_Occurred` to disambiguate.
184181
.. versionchanged:: 3.8
185182
Use :meth:`__index__` if available.
186183
187-
.. deprecated:: 3.8
188-
Using :meth:`__int__` is deprecated.
184+
.. versionchanged:: 3.10
185+
This function will no longer use :meth:`__int__`.
189186
190187
191188
.. c:function:: long long PyLong_AsLongLongAndOverflow(PyObject *obj, int *overflow)
192189
193190
Return a C :c:type:`long long` representation of *obj*. If *obj* is not an
194-
instance of :c:type:`PyLongObject`, first call its :meth:`__index__` or
195-
:meth:`__int__` method (if present) to convert it to a
196-
:c:type:`PyLongObject`.
191+
instance of :c:type:`PyLongObject`, first call its :meth:`__index__` method
192+
(if present) to convert it to a :c:type:`PyLongObject`.
197193
198194
If the value of *obj* is greater than :const:`LLONG_MAX` or less than
199195
:const:`LLONG_MIN`, set *\*overflow* to ``1`` or ``-1``, respectively,
@@ -207,8 +203,8 @@ distinguished from a number. Use :c:func:`PyErr_Occurred` to disambiguate.
207203
.. versionchanged:: 3.8
208204
Use :meth:`__index__` if available.
209205
210-
.. deprecated:: 3.8
211-
Using :meth:`__int__` is deprecated.
206+
.. versionchanged:: 3.10
207+
This function will no longer use :meth:`__int__`.
212208
213209
214210
.. c:function:: Py_ssize_t PyLong_AsSsize_t(PyObject *pylong)
@@ -278,10 +274,9 @@ distinguished from a number. Use :c:func:`PyErr_Occurred` to disambiguate.
278274
279275
.. c:function:: unsigned long PyLong_AsUnsignedLongMask(PyObject *obj)
280276
281-
Return a C :c:type:`unsigned long` representation of *obj*. If *obj*
282-
is not an instance of :c:type:`PyLongObject`, first call its
283-
:meth:`__index__` or :meth:`__int__` method (if present) to convert
284-
it to a :c:type:`PyLongObject`.
277+
Return a C :c:type:`unsigned long` representation of *obj*. If *obj* is not
278+
an instance of :c:type:`PyLongObject`, first call its :meth:`__index__`
279+
method (if present) to convert it to a :c:type:`PyLongObject`.
285280
286281
If the value of *obj* is out of range for an :c:type:`unsigned long`,
287282
return the reduction of that value modulo ``ULONG_MAX + 1``.
@@ -292,16 +287,16 @@ distinguished from a number. Use :c:func:`PyErr_Occurred` to disambiguate.
292287
.. versionchanged:: 3.8
293288
Use :meth:`__index__` if available.
294289
295-
.. deprecated:: 3.8
296-
Using :meth:`__int__` is deprecated.
290+
.. versionchanged:: 3.10
291+
This function will no longer use :meth:`__int__`.
297292
298293
299294
.. c:function:: unsigned long long PyLong_AsUnsignedLongLongMask(PyObject *obj)
300295
301296
Return a C :c:type:`unsigned long long` representation of *obj*. If *obj*
302297
is not an instance of :c:type:`PyLongObject`, first call its
303-
:meth:`__index__` or :meth:`__int__` method (if present) to convert
304-
it to a :c:type:`PyLongObject`.
298+
:meth:`__index__` method (if present) to convert it to a
299+
:c:type:`PyLongObject`.
305300
306301
If the value of *obj* is out of range for an :c:type:`unsigned long long`,
307302
return the reduction of that value modulo ``ULLONG_MAX + 1``.
@@ -312,8 +307,8 @@ distinguished from a number. Use :c:func:`PyErr_Occurred` to disambiguate.
312307
.. versionchanged:: 3.8
313308
Use :meth:`__index__` if available.
314309
315-
.. deprecated:: 3.8
316-
Using :meth:`__int__` is deprecated.
310+
.. versionchanged:: 3.10
311+
This function will no longer use :meth:`__int__`.
317312
318313
319314
.. c:function:: double PyLong_AsDouble(PyObject *pylong)

Doc/c-api/structures.rst

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,15 @@ the definition of all other Python objects.
6262
See documentation of :c:type:`PyVarObject` above.
6363

6464

65-
.. c:macro:: Py_TYPE(o)
65+
.. c:function:: PyTypeObject* Py_TYPE(const PyObject *o)
6666
67-
This macro is used to access the :attr:`ob_type` member of a Python object.
68-
It expands to::
67+
Get the type of the Python object *o*.
6968
70-
(((PyObject*)(o))->ob_type)
69+
Return a borrowed reference.
70+
71+
.. versionchanged:: 3.10
72+
:c:func:`Py_TYPE()` is changed to the inline static function.
73+
Use :c:func:`Py_SET_TYPE()` to set an object type.
7174
7275
7376
.. c:function:: int Py_IS_TYPE(PyObject *o, PyTypeObject *type)
@@ -85,13 +88,13 @@ the definition of all other Python objects.
8588
.. versionadded:: 3.9
8689
8790
88-
.. c:macro:: Py_REFCNT(o)
91+
.. c:function:: Py_ssize_t Py_REFCNT(const PyObject *o)
8992
90-
This macro is used to access the :attr:`ob_refcnt` member of a Python
91-
object.
92-
It expands to::
93+
Get the reference count of the Python object *o*.
9394
94-
(((PyObject*)(o))->ob_refcnt)
95+
.. versionchanged:: 3.10
96+
:c:func:`Py_REFCNT()` is changed to the inline static function.
97+
Use :c:func:`Py_SET_REFCNT()` to set an object reference count.
9598
9699
97100
.. c:function:: void Py_SET_REFCNT(PyObject *o, Py_ssize_t refcnt)
@@ -101,12 +104,13 @@ the definition of all other Python objects.
101104
.. versionadded:: 3.9
102105
103106
104-
.. c:macro:: Py_SIZE(o)
107+
.. c:function:: Py_ssize_t Py_SIZE(const PyVarObject *o)
105108
106-
This macro is used to access the :attr:`ob_size` member of a Python object.
107-
It expands to::
109+
Get the size of the Python object *o*.
108110
109-
(((PyVarObject*)(o))->ob_size)
111+
.. versionchanged:: 3.10
112+
:c:func:`Py_SIZE()` is changed to the inline static function.
113+
Use :c:func:`Py_SET_SIZE()` to set an object size.
110114
111115
112116
.. c:function:: void Py_SET_SIZE(PyVarObject *o, Py_ssize_t size)

Doc/c-api/typeobj.rst

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1223,11 +1223,25 @@ and :c:type:`PyType_Type` effectively act as defaults.)
12231223
but the instance has no strong reference to the elements inside it, as they
12241224
are allowed to be removed even if the instance is still alive).
12251225

1226-
12271226
Note that :c:func:`Py_VISIT` requires the *visit* and *arg* parameters to
12281227
:c:func:`local_traverse` to have these specific names; don't name them just
12291228
anything.
12301229

1230+
Heap-allocated types (:const:`Py_TPFLAGS_HEAPTYPE`, such as those created
1231+
with :c:func:`PyType_FromSpec` and similar APIs) hold a reference to their
1232+
type. Their traversal function must therefore either visit
1233+
:c:func:`Py_TYPE(self) <Py_TYPE>`, or delegate this responsibility by
1234+
calling ``tp_traverse`` of another heap-allocated type (such as a
1235+
heap-allocated superclass).
1236+
If they do not, the type object may not be garbage-collected.
1237+
1238+
.. versionchanged:: 3.9
1239+
1240+
Heap-allocated types are expected to visit ``Py_TYPE(self)`` in
1241+
``tp_traverse``. In earlier versions of Python, due to
1242+
`bug 40217 <https://bugs.python.org/issue40217>`_, doing this
1243+
may lead to crashes in subclasses.
1244+
12311245
**Inheritance:**
12321246

12331247
Group: :const:`Py_TPFLAGS_HAVE_GC`, :attr:`tp_traverse`, :attr:`tp_clear`

0 commit comments

Comments
 (0)
0