Skip to content

Commit e94c679

Browse files
committed
Issue python#1717: rename tp_compare to tp_reserved. I'll change the
type of tp_compare in a separate commit, for ease of reversion should things go wrong.
1 parent 438cecd commit e94c679

Some content is hidden

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

99 files changed

+215
-216
lines changed

Include/object.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ typedef struct _typeobject {
297297
printfunc tp_print;
298298
getattrfunc tp_getattr;
299299
setattrfunc tp_setattr;
300-
cmpfunc tp_compare;
300+
cmpfunc tp_reserved;
301301
reprfunc tp_repr;
302302

303303
/* Method suites for standard classes */

Misc/NEWS

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,8 @@ Core and Builtins
1414

1515
- Issue #1717: Removed builtin cmp() function, dropped tp_compare
1616
slot, the C API functions PyObject_Compare and PyUnicode_Compare and
17-
the type definition cmpfunc. The tp_compare slot is reserved for
18-
future usage. An attempt to initialize a type with a nonzero
19-
tp_compare slot will raise TypeError.
17+
the type definition cmpfunc. The tp_compare slot has been renamed
18+
to tp_reserved, and is reserved for future usage.
2019

2120
- Issue #4707: round(x, n) now returns an integer if x is an integer.
2221
Previously it returned a float.

Modules/_bytesio.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -698,7 +698,7 @@ static PyTypeObject BytesIO_Type = {
698698
0, /*tp_print*/
699699
0, /*tp_getattr*/
700700
0, /*tp_setattr*/
701-
0, /*tp_compare*/
701+
0, /*tp_reserved*/
702702
0, /*tp_repr*/
703703
0, /*tp_as_number*/
704704
0, /*tp_as_sequence*/

Modules/_collectionsmodule.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -848,7 +848,7 @@ static PyTypeObject deque_type = {
848848
0, /* tp_print */
849849
0, /* tp_getattr */
850850
0, /* tp_setattr */
851-
0, /* tp_compare */
851+
0, /* tp_reserved */
852852
deque_repr, /* tp_repr */
853853
0, /* tp_as_number */
854854
&deque_as_sequence, /* tp_as_sequence */
@@ -978,7 +978,7 @@ static PyTypeObject dequeiter_type = {
978978
0, /* tp_print */
979979
0, /* tp_getattr */
980980
0, /* tp_setattr */
981-
0, /* tp_compare */
981+
0, /* tp_reserved */
982982
0, /* tp_repr */
983983
0, /* tp_as_number */
984984
0, /* tp_as_sequence */
@@ -1061,7 +1061,7 @@ static PyTypeObject dequereviter_type = {
10611061
0, /* tp_print */
10621062
0, /* tp_getattr */
10631063
0, /* tp_setattr */
1064-
0, /* tp_compare */
1064+
0, /* tp_reserved */
10651065
0, /* tp_repr */
10661066
0, /* tp_as_number */
10671067
0, /* tp_as_sequence */
@@ -1318,7 +1318,7 @@ static PyTypeObject defdict_type = {
13181318
0, /* tp_print */
13191319
0, /* tp_getattr */
13201320
0, /* tp_setattr */
1321-
0, /* tp_compare */
1321+
0, /* tp_reserved */
13221322
(reprfunc)defdict_repr, /* tp_repr */
13231323
0, /* tp_as_number */
13241324
0, /* tp_as_sequence */

Modules/_csv.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,7 @@ static PyTypeObject Dialect_Type = {
443443
(printfunc)0, /* tp_print */
444444
(getattrfunc)0, /* tp_getattr */
445445
(setattrfunc)0, /* tp_setattr */
446-
0, /* tp_compare */
446+
0, /* tp_reserved */
447447
(reprfunc)0, /* tp_repr */
448448
0, /* tp_as_number */
449449
0, /* tp_as_sequence */
@@ -864,7 +864,7 @@ static PyTypeObject Reader_Type = {
864864
(printfunc)0, /*tp_print*/
865865
(getattrfunc)0, /*tp_getattr*/
866866
(setattrfunc)0, /*tp_setattr*/
867-
0, /*tp_compare*/
867+
0, /*tp_reserved*/
868868
(reprfunc)0, /*tp_repr*/
869869
0, /*tp_as_number*/
870870
0, /*tp_as_sequence*/
@@ -1286,7 +1286,7 @@ static PyTypeObject Writer_Type = {
12861286
(printfunc)0, /*tp_print*/
12871287
(getattrfunc)0, /*tp_getattr*/
12881288
(setattrfunc)0, /*tp_setattr*/
1289-
0, /*tp_compare*/
1289+
0, /*tp_reserved*/
12901290
(reprfunc)0, /*tp_repr*/
12911291
0, /*tp_as_number*/
12921292
0, /*tp_as_sequence*/

Modules/_ctypes/_ctypes.c

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ static PyTypeObject DictRemover_Type = {
179179
0, /* tp_print */
180180
0, /* tp_getattr */
181181
0, /* tp_setattr */
182-
0, /* tp_compare */
182+
0, /* tp_reserved */
183183
0, /* tp_repr */
184184
0, /* tp_as_number */
185185
0, /* tp_as_sequence */
@@ -713,7 +713,7 @@ PyTypeObject StructType_Type = {
713713
0, /* tp_print */
714714
0, /* tp_getattr */
715715
0, /* tp_setattr */
716-
0, /* tp_compare */
716+
0, /* tp_reserved */
717717
0, /* tp_repr */
718718
0, /* tp_as_number */
719719
&CDataType_as_sequence, /* tp_as_sequence */
@@ -755,7 +755,7 @@ static PyTypeObject UnionType_Type = {
755755
0, /* tp_print */
756756
0, /* tp_getattr */
757757
0, /* tp_setattr */
758-
0, /* tp_compare */
758+
0, /* tp_reserved */
759759
0, /* tp_repr */
760760
0, /* tp_as_number */
761761
&CDataType_as_sequence, /* tp_as_sequence */
@@ -988,7 +988,7 @@ PyTypeObject PointerType_Type = {
988988
0, /* tp_print */
989989
0, /* tp_getattr */
990990
0, /* tp_setattr */
991-
0, /* tp_compare */
991+
0, /* tp_reserved */
992992
0, /* tp_repr */
993993
0, /* tp_as_number */
994994
&CDataType_as_sequence, /* tp_as_sequence */
@@ -1390,7 +1390,7 @@ PyTypeObject ArrayType_Type = {
13901390
0, /* tp_print */
13911391
0, /* tp_getattr */
13921392
0, /* tp_setattr */
1393-
0, /* tp_compare */
1393+
0, /* tp_reserved */
13941394
0, /* tp_repr */
13951395
0, /* tp_as_number */
13961396
&CDataType_as_sequence, /* tp_as_sequence */
@@ -2059,7 +2059,7 @@ PyTypeObject SimpleType_Type = {
20592059
0, /* tp_print */
20602060
0, /* tp_getattr */
20612061
0, /* tp_setattr */
2062-
0, /* tp_compare */
2062+
0, /* tp_reserved */
20632063
0, /* tp_repr */
20642064
0, /* tp_as_number */
20652065
&CDataType_as_sequence, /* tp_as_sequence */
@@ -2277,7 +2277,7 @@ PyTypeObject CFuncPtrType_Type = {
22772277
0, /* tp_print */
22782278
0, /* tp_getattr */
22792279
0, /* tp_setattr */
2280-
0, /* tp_compare */
2280+
0, /* tp_reserved */
22812281
0, /* tp_repr */
22822282
0, /* tp_as_number */
22832283
&CDataType_as_sequence, /* tp_as_sequence */
@@ -2560,7 +2560,7 @@ PyTypeObject CData_Type = {
25602560
0, /* tp_print */
25612561
0, /* tp_getattr */
25622562
0, /* tp_setattr */
2563-
0, /* tp_compare */
2563+
0, /* tp_reserved */
25642564
0, /* tp_repr */
25652565
0, /* tp_as_number */
25662566
0, /* tp_as_sequence */
@@ -3889,7 +3889,7 @@ PyTypeObject CFuncPtr_Type = {
38893889
0, /* tp_print */
38903890
0, /* tp_getattr */
38913891
0, /* tp_setattr */
3892-
0, /* tp_compare */
3892+
0, /* tp_reserved */
38933893
(reprfunc)CFuncPtr_repr, /* tp_repr */
38943894
&CFuncPtr_as_number, /* tp_as_number */
38953895
0, /* tp_as_sequence */
@@ -4032,7 +4032,7 @@ static PyTypeObject Struct_Type = {
40324032
0, /* tp_print */
40334033
0, /* tp_getattr */
40344034
0, /* tp_setattr */
4035-
0, /* tp_compare */
4035+
0, /* tp_reserved */
40364036
0, /* tp_repr */
40374037
0, /* tp_as_number */
40384038
0, /* tp_as_sequence */
@@ -4074,7 +4074,7 @@ static PyTypeObject Union_Type = {
40744074
0, /* tp_print */
40754075
0, /* tp_getattr */
40764076
0, /* tp_setattr */
4077-
0, /* tp_compare */
4077+
0, /* tp_reserved */
40784078
0, /* tp_repr */
40794079
0, /* tp_as_number */
40804080
0, /* tp_as_sequence */
@@ -4383,7 +4383,7 @@ PyTypeObject Array_Type = {
43834383
0, /* tp_print */
43844384
0, /* tp_getattr */
43854385
0, /* tp_setattr */
4386-
0, /* tp_compare */
4386+
0, /* tp_reserved */
43874387
0, /* tp_repr */
43884388
0, /* tp_as_number */
43894389
&Array_as_sequence, /* tp_as_sequence */
@@ -4615,7 +4615,7 @@ static PyTypeObject Simple_Type = {
46154615
0, /* tp_print */
46164616
0, /* tp_getattr */
46174617
0, /* tp_setattr */
4618-
0, /* tp_compare */
4618+
0, /* tp_reserved */
46194619
(reprfunc)&Simple_repr, /* tp_repr */
46204620
&Simple_as_number, /* tp_as_number */
46214621
0, /* tp_as_sequence */
@@ -4992,7 +4992,7 @@ PyTypeObject Pointer_Type = {
49924992
0, /* tp_print */
49934993
0, /* tp_getattr */
49944994
0, /* tp_setattr */
4995-
0, /* tp_compare */
4995+
0, /* tp_reserved */
49964996
0, /* tp_repr */
49974997
&Pointer_as_number, /* tp_as_number */
49984998
&Pointer_as_sequence, /* tp_as_sequence */
@@ -5086,7 +5086,7 @@ static PyTypeObject PyComError_Type = {
50865086
0, /* tp_print */
50875087
0, /* tp_getattr */
50885088
0, /* tp_setattr */
5089-
0, /* tp_compare */
5089+
0, /* tp_reserved */
50905090
0, /* tp_repr */
50915091
0, /* tp_as_number */
50925092
0, /* tp_as_sequence */

Modules/_ctypes/callbacks.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ PyTypeObject CThunk_Type = {
5050
0, /* tp_print */
5151
0, /* tp_getattr */
5252
0, /* tp_setattr */
53-
0, /* tp_compare */
53+
0, /* tp_reserved */
5454
0, /* tp_repr */
5555
0, /* tp_as_number */
5656
0, /* tp_as_sequence */

Modules/_ctypes/callproc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -512,7 +512,7 @@ PyTypeObject PyCArg_Type = {
512512
0, /* tp_print */
513513
0, /* tp_getattr */
514514
0, /* tp_setattr */
515-
0, /* tp_compare */
515+
0, /* tp_reserved */
516516
(reprfunc)PyCArg_repr, /* tp_repr */
517517
0, /* tp_as_number */
518518
0, /* tp_as_sequence */

Modules/_ctypes/cfield.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ PyTypeObject CField_Type = {
289289
0, /* tp_print */
290290
0, /* tp_getattr */
291291
0, /* tp_setattr */
292-
0, /* tp_compare */
292+
0, /* tp_reserved */
293293
(reprfunc)CField_repr, /* tp_repr */
294294
0, /* tp_as_number */
295295
0, /* tp_as_sequence */

Modules/_ctypes/stgdict.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ PyTypeObject StgDict_Type = {
111111
0, /* tp_print */
112112
0, /* tp_getattr */
113113
0, /* tp_setattr */
114-
0, /* tp_compare */
114+
0, /* tp_reserved */
115115
0, /* tp_repr */
116116
0, /* tp_as_number */
117117
0, /* tp_as_sequence */

0 commit comments

Comments
 (0)