Skip to content

Commit 7bbc34b

Browse files
committed
bpo-36974: further manual changes
1 parent a17ae12 commit 7bbc34b

File tree

24 files changed

+48
-50
lines changed

24 files changed

+48
-50
lines changed

Doc/c-api/type.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ The following functions and structs are used to create
191191
* :c:member:`~PyTypeObject.tp_cache`
192192
* :c:member:`~PyTypeObject.tp_subclasses`
193193
* :c:member:`~PyTypeObject.tp_weaklist`
194-
* :c:member:`~PyTypeObject.tp_vectorcall_offset`
194+
* :c:member:`~PyTypeObject.tp_print`
195195
* :c:member:`~PyTypeObject.tp_weaklistoffset`
196196
* :c:member:`~PyTypeObject.tp_dictoffset`
197197
* :c:member:`~PyBufferProcs.bf_getbuffer`

Doc/c-api/typeobj.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ Quick Reference
4949
+---------------------------------------------+-----------------------------------+-------------------+---+---+---+---+
5050
| :c:member:`~PyTypeObject.tp_dealloc` | :c:type:`destructor` | | X | X | | X |
5151
+---------------------------------------------+-----------------------------------+-------------------+---+---+---+---+
52-
| (:c:member:`~PyTypeObject.tp_vectorcall_offset`) | |
52+
| (:c:member:`~PyTypeObject.tp_print`) | |
5353
+---------------------------------------------+-----------------------------------+-------------------+---+---+---+---+
5454
| (:c:member:`~PyTypeObject.tp_getattr`) | :c:type:`getattrfunc` | __getattribute__, | | | | G |
5555
| | | __getattr__ | | | | |
@@ -675,7 +675,7 @@ and :c:type:`PyType_Type` effectively act as defaults.)
675675
This field is inherited by subtypes.
676676

677677

678-
.. c:member:: printfunc PyTypeObject.tp_vectorcall_offset
678+
.. c:member:: printfunc PyTypeObject.tp_print
679679
680680
Reserved slot, formerly used for print formatting in Python 2.x.
681681

@@ -721,7 +721,7 @@ and :c:type:`PyType_Type` effectively act as defaults.)
721721
protocols at the C-level. See :ref:`async-structs` for details.
722722

723723
.. versionadded:: 3.5
724-
Formerly known as ``tp_as_async`` and ``tp_as_async``.
724+
Formerly known as ``tp_compare`` and ``tp_reserved``.
725725

726726
**Inheritance:**
727727

@@ -2404,7 +2404,7 @@ with a more verbose initializer::
24042404
sizeof(MyObject), /* tp_basicsize */
24052405
0, /* tp_itemsize */
24062406
(destructor)myobj_dealloc, /* tp_dealloc */
2407-
0, /* tp_vectorcall_offset */
2407+
0, /* tp_print */
24082408
0, /* tp_getattr */
24092409
0, /* tp_setattr */
24102410
0, /* tp_as_async */

Doc/includes/typestruct.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ typedef struct _typeobject {
66
/* Methods to implement standard operations */
77

88
destructor tp_dealloc;
9-
printfunc tp_vectorcall_offset;
9+
printfunc tp_print;
1010
getattrfunc tp_getattr;
1111
setattrfunc tp_setattr;
12-
PyAsyncMethods *tp_as_async; /* formerly known as tp_as_async (Python 2)
13-
or tp_as_async (Python 3) */
12+
PyAsyncMethods *tp_as_async; /* formerly known as tp_compare (Python 2)
13+
or tp_reserved (Python 3) */
1414
reprfunc tp_repr;
1515

1616
/* Method suites for standard classes */

Doc/whatsnew/3.5.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2531,7 +2531,7 @@ Changes in the C API
25312531
the future.
25322532
(Contributed by Serhiy Storchaka in :issue:`20204`.)
25332533

2534-
* As part of the :pep:`492` implementation, the ``tp_as_async`` slot of
2534+
* As part of the :pep:`492` implementation, the ``tp_reserved`` slot of
25352535
:c:type:`PyTypeObject` was replaced with a
25362536
:c:member:`tp_as_async` slot. Refer to :ref:`coro-objects` for
25372537
new types, structures and functions.

Include/cpython/object.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,8 +185,8 @@ typedef struct _typeobject {
185185
Py_ssize_t tp_vectorcall_offset;
186186
getattrfunc tp_getattr;
187187
setattrfunc tp_setattr;
188-
PyAsyncMethods *tp_as_async; /* formerly known as tp_as_async (Python 2)
189-
or tp_as_async (Python 3) */
188+
PyAsyncMethods *tp_as_async; /* formerly known as tp_compare (Python 2)
189+
or tp_reserved (Python 3) */
190190
reprfunc tp_repr;
191191

192192
/* Method suites for standard classes */

Lib/test/test_defaultdict.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ def test_print(self):
7777
def foo(): return 42
7878
d2 = defaultdict(foo, {1: 2})
7979
# NOTE: We can't use tempfile.[Named]TemporaryFile since this
80-
# code must exercise the tp_vectorcall_offset C code, which only gets
80+
# code must exercise the tp_print C code, which only gets
8181
# invoked for *real* files.
8282
tfn = tempfile.mktemp()
8383
try:
@@ -161,7 +161,7 @@ def _factory(self):
161161
r"of sub\(\.\.\., \{\}\)>, \{\}\)")
162162

163163
# NOTE: printing a subclass of a builtin type does not call its
164-
# tp_vectorcall_offset slot. So this part is essentially the same test as above.
164+
# tp_print slot. So this part is essentially the same test as above.
165165
tfn = tempfile.mktemp()
166166
try:
167167
f = open(tfn, "w+")

Misc/HISTORY

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15238,10 +15238,10 @@ Core and Builtins
1523815238

1523915239
- Issue #5182: Removed memoryview.__str__.
1524015240

15241-
- Issue #1717: Removed builtin cmp() function, dropped tp_as_async
15241+
- Issue #1717: Removed builtin cmp() function, dropped tp_compare
1524215242
slot, the C API functions PyObject_Compare and PyUnicode_Compare and
15243-
the type definition cmpfunc. The tp_as_async slot has been renamed
15244-
to tp_as_async, and is reserved for future usage.
15243+
the type definition cmpfunc. The tp_compare slot has been renamed
15244+
to tp_reserved, and is reserved for future usage.
1524515245

1524615246
- Issue #1242657: the __len__() and __length_hint__() calls in several tools
1524715247
were suppressing all exceptions. These include list() and bytearray().
@@ -23981,7 +23981,7 @@ Build
2398123981
C API
2398223982
-----
2398323983

23984-
- The documentation for the tp_as_async slot is updated to require that
23984+
- The documentation for the tp_compare slot is updated to require that
2398523985
the return value must be -1, 0, 1; an arbitrary number <0 or >0 is
2398623986
not correct. This is not yet enforced but will be enforced in
2398723987
Python 2.3; even later, we may use -2 to indicate errors and +2 for
@@ -25419,7 +25419,7 @@ Core language, builtins, and interpreter
2541925419
which is guaranteed to have the type that provided the function) and
2542025420
an integer indicating the opcode, which can be Py_LT, Py_LE, Py_EQ,
2542125421
Py_NE, Py_GT, Py_GE (for <, <=, ==, !=, >, >=), and returns a Python
25422-
object, which may be NotImplemented (in which case the tp_as_async
25422+
object, which may be NotImplemented (in which case the tp_compare
2542325423
slot function is used as a fallback, if defined).
2542425424

2542525425
Classes can overload individual comparison operators by defining one

Modules/_blake2/blake2b_impl.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -401,10 +401,10 @@ PyTypeObject PyBlake2_BLAKE2bType = {
401401
sizeof(BLAKE2bObject), /* tp_basicsize */
402402
0, /* tp_itemsize */
403403
py_blake2b_dealloc, /* tp_dealloc */
404-
0, /* tp_vectorcall_offset */
404+
0, /*tp_vectorcall_offset*/
405405
0, /* tp_getattr */
406406
0, /* tp_setattr */
407-
0, /* tp_as_async */
407+
0, /* tp_as_async */
408408
0, /* tp_repr */
409409
0, /* tp_as_number */
410410
0, /* tp_as_sequence */

Modules/_blake2/blake2s_impl.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -401,10 +401,10 @@ PyTypeObject PyBlake2_BLAKE2sType = {
401401
sizeof(BLAKE2sObject), /* tp_basicsize */
402402
0, /* tp_itemsize */
403403
py_blake2s_dealloc, /* tp_dealloc */
404-
0, /* tp_vectorcall_offset */
404+
0, /*tp_vectorcall_offset*/
405405
0, /* tp_getattr */
406406
0, /* tp_setattr */
407-
0, /* tp_as_async */
407+
0, /* tp_as_async */
408408
0, /* tp_repr */
409409
0, /* tp_as_number */
410410
0, /* tp_as_sequence */

Modules/_csv.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,7 @@ static PyTypeObject Dialect_Type = {
469469
0, /* tp_itemsize */
470470
/* methods */
471471
(destructor)Dialect_dealloc, /* tp_dealloc */
472-
(printfunc)0, /* tp_vectorcall_offset */
472+
0, /* tp_vectorcall_offset */
473473
(getattrfunc)0, /* tp_getattr */
474474
(setattrfunc)0, /* tp_setattr */
475475
0, /* tp_as_async */
@@ -902,10 +902,10 @@ static PyTypeObject Reader_Type = {
902902
0, /*tp_itemsize*/
903903
/* methods */
904904
(destructor)Reader_dealloc, /*tp_dealloc*/
905-
(printfunc)0, /*tp_vectorcall_offset*/
905+
0, /*tp_vectorcall_offset*/
906906
(getattrfunc)0, /*tp_getattr*/
907907
(setattrfunc)0, /*tp_setattr*/
908-
0, /*tp_as_async*/
908+
0, /*tp_as_async*/
909909
(reprfunc)0, /*tp_repr*/
910910
0, /*tp_as_number*/
911911
0, /*tp_as_sequence*/
@@ -1332,7 +1332,7 @@ static PyTypeObject Writer_Type = {
13321332
0, /*tp_itemsize*/
13331333
/* methods */
13341334
(destructor)Writer_dealloc, /*tp_dealloc*/
1335-
(printfunc)0, /*tp_vectorcall_offset*/
1335+
0, /*tp_vectorcall_offset*/
13361336
(getattrfunc)0, /*tp_getattr*/
13371337
(setattrfunc)0, /*tp_setattr*/
13381338
0, /*tp_as_async*/

0 commit comments

Comments
 (0)