Skip to content

Commit 8055afd

Browse files
committed
Issue python#4910, patch 3/3: rename nb_long to nb_reserved
1 parent 0bbcc4c commit 8055afd

File tree

12 files changed

+19
-14
lines changed

12 files changed

+19
-14
lines changed

Doc/c-api/typeobj.rst

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1057,7 +1057,7 @@ Number Object Structures
10571057
binaryfunc nb_xor;
10581058
binaryfunc nb_or;
10591059
unaryfunc nb_int;
1060-
unaryfunc nb_long;
1060+
void *nb_reserved;
10611061
unaryfunc nb_float;
10621062

10631063
binaryfunc nb_inplace_add;
@@ -1088,6 +1088,12 @@ Number Object Structures
10881088
``Py_NotImplemented``, if another error occurred they must return ``NULL``
10891089
and set an exception.
10901090

1091+
.. note::
1092+
1093+
The :cdata:`nb_reserved` field should always be ``NULL``. It
1094+
was previously called :cdata:`nb_long`, and was renamed in
1095+
Python 3.0.1.
1096+
10911097

10921098
.. _mapping-structs:
10931099

Include/object.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ typedef struct {
219219
binaryfunc nb_xor;
220220
binaryfunc nb_or;
221221
unaryfunc nb_int;
222-
unaryfunc nb_long;
222+
void *nb_reserved; /* the slot formerly known as nb_long */
223223
unaryfunc nb_float;
224224

225225
binaryfunc nb_inplace_add;

Misc/NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ What's New in Python 3.1 alpha 0
1212
Core and Builtins
1313
-----------------
1414

15+
- Issue #4910: Rename nb_long slot to nb_reserved, and change its
16+
type to (void *).
17+
1518
- Issue #4935: The overflow checking code in the expandtabs() method common
1619
to str, bytes and bytearray could be optimized away by the compiler, letting
1720
the interpreter segfault instead of raising an error.

Modules/datetimemodule.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2111,7 +2111,7 @@ static PyNumberMethods delta_as_number = {
21112111
0, /*nb_xor*/
21122112
0, /*nb_or*/
21132113
0, /*nb_int*/
2114-
0, /*nb_long*/
2114+
0, /*nb_reserved*/
21152115
0, /*nb_float*/
21162116
0, /*nb_inplace_add*/
21172117
0, /*nb_inplace_subtract*/

Objects/boolobject.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ static PyNumberMethods bool_as_number = {
109109
bool_xor, /* nb_xor */
110110
bool_or, /* nb_or */
111111
0, /* nb_int */
112-
0, /* nb_long */
112+
0, /* nb_reserved */
113113
0, /* nb_float */
114114
0, /* nb_inplace_add */
115115
0, /* nb_inplace_subtract */

Objects/complexobject.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1060,7 +1060,7 @@ static PyNumberMethods complex_as_number = {
10601060
0, /* nb_xor */
10611061
0, /* nb_or */
10621062
complex_int, /* nb_int */
1063-
0, /* nb_long */
1063+
0, /* nb_reserved */
10641064
complex_float, /* nb_float */
10651065
0, /* nb_inplace_add */
10661066
0, /* nb_inplace_subtract */

Objects/floatobject.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1798,7 +1798,7 @@ static PyNumberMethods float_as_number = {
17981798
0, /*nb_xor*/
17991799
0, /*nb_or*/
18001800
float_trunc, /*nb_int*/
1801-
0, /*nb_long*/
1801+
0, /*nb_reserved*/
18021802
float_float, /*nb_float*/
18031803
0, /* nb_inplace_add */
18041804
0, /* nb_inplace_subtract */

Objects/longobject.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3830,7 +3830,7 @@ static PyNumberMethods long_as_number = {
38303830
long_xor, /*nb_xor*/
38313831
long_or, /*nb_or*/
38323832
long_long, /*nb_int*/
3833-
0, /*nb_long*/
3833+
0, /*nb_reserved*/
38343834
long_float, /*nb_float*/
38353835
0, /* nb_inplace_add */
38363836
0, /* nb_inplace_subtract */

Objects/setobject.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2082,7 +2082,7 @@ static PyNumberMethods set_as_number = {
20822082
(binaryfunc)set_xor, /*nb_xor*/
20832083
(binaryfunc)set_or, /*nb_or*/
20842084
0, /*nb_int*/
2085-
0, /*nb_long*/
2085+
0, /*nb_reserved*/
20862086
0, /*nb_float*/
20872087
0, /*nb_inplace_add*/
20882088
(binaryfunc)set_isub, /*nb_inplace_subtract*/

Objects/typeobject.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3602,7 +3602,6 @@ inherit_slots(PyTypeObject *type, PyTypeObject *base)
36023602
COPYNUM(nb_xor);
36033603
COPYNUM(nb_or);
36043604
COPYNUM(nb_int);
3605-
COPYNUM(nb_long);
36063605
COPYNUM(nb_float);
36073606
COPYNUM(nb_inplace_add);
36083607
COPYNUM(nb_inplace_subtract);
@@ -4827,7 +4826,6 @@ SLOT1BIN(slot_nb_xor, nb_xor, "__xor__", "__rxor__")
48274826
SLOT1BIN(slot_nb_or, nb_or, "__or__", "__ror__")
48284827

48294828
SLOT0(slot_nb_int, "__int__")
4830-
SLOT0(slot_nb_long, "__long__")
48314829
SLOT0(slot_nb_float, "__float__")
48324830
SLOT1(slot_nb_inplace_add, "__iadd__", PyObject *, "O")
48334831
SLOT1(slot_nb_inplace_subtract, "__isub__", PyObject *, "O")
@@ -5443,8 +5441,6 @@ static slotdef slotdefs[] = {
54435441
RBINSLOT("__ror__", nb_or, slot_nb_or, "|"),
54445442
UNSLOT("__int__", nb_int, slot_nb_int, wrap_unaryfunc,
54455443
"int(x)"),
5446-
UNSLOT("__long__", nb_long, slot_nb_long, wrap_unaryfunc,
5447-
"int(x)"),
54485444
UNSLOT("__float__", nb_float, slot_nb_float, wrap_unaryfunc,
54495445
"float(x)"),
54505446
NBSLOT("__index__", nb_index, slot_nb_index, wrap_unaryfunc,

0 commit comments

Comments
 (0)