Skip to content

Commit 4f92ca4

Browse files
committed
Remove nb_reserved (nb_coerce), nb_hex, and nb_oct from PyNumberMethods
1 parent 624a789 commit 4f92ca4

11 files changed

Lines changed: 3 additions & 32 deletions

File tree

Doc/c-api/typeobj.rst

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1049,13 +1049,9 @@ Number Object Structures
10491049
binaryfunc nb_and;
10501050
binaryfunc nb_xor;
10511051
binaryfunc nb_or;
1052-
int nb_reserved; /* unused, must be zero */
10531052
unaryfunc nb_int;
10541053
unaryfunc nb_long;
10551054
unaryfunc nb_float;
1056-
1057-
unaryfunc nb_oct; /* not used anymore, must be zero */
1058-
unaryfunc nb_hex; /* not used anymore, must be zero */
10591055

10601056
binaryfunc nb_inplace_add;
10611057
binaryfunc nb_inplace_subtract;

Include/object.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -215,13 +215,9 @@ typedef struct {
215215
binaryfunc nb_and;
216216
binaryfunc nb_xor;
217217
binaryfunc nb_or;
218-
int nb_reserved; /* unused, used to be nb_coerce */
219218
unaryfunc nb_int;
220219
unaryfunc nb_long;
221220
unaryfunc nb_float;
222-
/* NB: nb_oct and nb_hex are not used anymore. */
223-
unaryfunc nb_oct;
224-
unaryfunc nb_hex;
225221

226222
binaryfunc nb_inplace_add;
227223
binaryfunc nb_inplace_subtract;

Misc/NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,9 @@ Core and Builtins
6060
f_exc_type, f_exc_value, and f_exc_traceback cannot be accessed from Python
6161
code anymore.
6262

63+
- Three of PyNumberMethods' members, nb_coerce, nb_hex, and nb_oct, have been
64+
removed.
65+
6366
Extension Modules
6467
-----------------
6568

Modules/datetimemodule.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2103,12 +2103,9 @@ static PyNumberMethods delta_as_number = {
21032103
0, /*nb_and*/
21042104
0, /*nb_xor*/
21052105
0, /*nb_or*/
2106-
0, /*nb_reserved*/
21072106
0, /*nb_int*/
21082107
0, /*nb_long*/
21092108
0, /*nb_float*/
2110-
0, /*nb_oct*/
2111-
0, /*nb_hex*/
21122109
0, /*nb_inplace_add*/
21132110
0, /*nb_inplace_subtract*/
21142111
0, /*nb_inplace_multiply*/

Objects/boolobject.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,12 +108,9 @@ static PyNumberMethods bool_as_number = {
108108
bool_and, /* nb_and */
109109
bool_xor, /* nb_xor */
110110
bool_or, /* nb_or */
111-
0, /* nb_reserved */
112111
0, /* nb_int */
113112
0, /* nb_long */
114113
0, /* nb_float */
115-
0, /* nb_oct */
116-
0, /* nb_hex */
117114
0, /* nb_inplace_add */
118115
0, /* nb_inplace_subtract */
119116
0, /* nb_inplace_multiply */

Objects/complexobject.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1067,12 +1067,9 @@ static PyNumberMethods complex_as_number = {
10671067
0, /* nb_and */
10681068
0, /* nb_xor */
10691069
0, /* nb_or */
1070-
0, /* nb_reserved */
10711070
complex_int, /* nb_int */
10721071
complex_long, /* nb_long */
10731072
complex_float, /* nb_float */
1074-
0, /* nb_oct */
1075-
0, /* nb_hex */
10761073
0, /* nb_inplace_add */
10771074
0, /* nb_inplace_subtract */
10781075
0, /* nb_inplace_multiply*/

Objects/floatobject.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1381,12 +1381,9 @@ static PyNumberMethods float_as_number = {
13811381
0, /*nb_and*/
13821382
0, /*nb_xor*/
13831383
0, /*nb_or*/
1384-
0, /*nb_reserved*/
13851384
float_trunc, /*nb_int*/
13861385
float_trunc, /*nb_long*/
13871386
float_float, /*nb_float*/
1388-
0, /* nb_oct */
1389-
0, /* nb_hex */
13901387
0, /* nb_inplace_add */
13911388
0, /* nb_inplace_subtract */
13921389
0, /* nb_inplace_multiply */

Objects/longobject.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3713,12 +3713,9 @@ static PyNumberMethods long_as_number = {
37133713
long_and, /*nb_and*/
37143714
long_xor, /*nb_xor*/
37153715
long_or, /*nb_or*/
3716-
0, /*nb_reserved*/
37173716
long_long, /*nb_int*/
37183717
long_long, /*nb_long*/
37193718
long_float, /*nb_float*/
3720-
0, /*nb_oct*/ /* not used */
3721-
0, /*nb_hex*/ /* not used */
37223719
0, /* nb_inplace_add */
37233720
0, /* nb_inplace_subtract */
37243721
0, /* nb_inplace_multiply */

Objects/setobject.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2015,12 +2015,9 @@ static PyNumberMethods set_as_number = {
20152015
(binaryfunc)set_and, /*nb_and*/
20162016
(binaryfunc)set_xor, /*nb_xor*/
20172017
(binaryfunc)set_or, /*nb_or*/
2018-
0, /*nb_reserved*/
20192018
0, /*nb_int*/
20202019
0, /*nb_long*/
20212020
0, /*nb_float*/
2022-
0, /*nb_oct*/
2023-
0, /*nb_hex*/
20242021
0, /*nb_inplace_add*/
20252022
(binaryfunc)set_isub, /*nb_inplace_subtract*/
20262023
0, /*nb_inplace_multiply*/

Objects/weakrefobject.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -594,12 +594,9 @@ static PyNumberMethods proxy_as_number = {
594594
proxy_and, /*nb_and*/
595595
proxy_xor, /*nb_xor*/
596596
proxy_or, /*nb_or*/
597-
0, /*nb_reserved*/
598597
proxy_int, /*nb_int*/
599598
proxy_long, /*nb_long*/
600599
proxy_float, /*nb_float*/
601-
0, /*nb_oct*/
602-
0, /*nb_hex*/
603600
proxy_iadd, /*nb_inplace_add*/
604601
proxy_isub, /*nb_inplace_subtract*/
605602
proxy_imul, /*nb_inplace_multiply*/

0 commit comments

Comments
 (0)