Skip to content

Commit a6f7d2e

Browse files
committed
Simplify pointer_bits handling
1 parent 8890dc5 commit a6f7d2e

File tree

2 files changed

+2
-26
lines changed

2 files changed

+2
-26
lines changed

Doc/library/sys.rst

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,7 @@ always available. Unless explicitly noted otherwise, all variables are read-only
1818
.. attribute:: abi_info.pointer_bits
1919

2020
The width of pointers in bits, as an integer.
21-
22-
* ``32``: 32-bit build
23-
* ``64``: 64-bit build
24-
* ``None`` if this information is unknown or neither 32 nore 64 bits.
21+
Equivalent to ``8 * sizeof(void *)``, i.e. usually ``32`` or ``64``.
2522

2623
.. attribute:: abi_info.Py_GIL_DISABLED
2724

Python/abiinfo.c

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -25,27 +25,6 @@ static PyStructSequence_Desc abi_info_desc = {
2525
3
2626
};
2727

28-
PyObject *
29-
_PyAbiInfo_GetPointerBits(void)
30-
{
31-
PyObject *pointer_bits;
32-
switch (SIZEOF_VOID_P) {
33-
case 4:
34-
pointer_bits = PyLong_FromLong(32);
35-
break;
36-
case 8:
37-
pointer_bits = PyLong_FromLong(64);
38-
break;
39-
default:
40-
pointer_bits = Py_NewRef(Py_None);
41-
break;
42-
}
43-
if (pointer_bits == NULL) {
44-
return NULL;
45-
}
46-
return pointer_bits;
47-
}
48-
4928
PyObject *
5029
PyAbiInfo_GetInfo(void)
5130
{
@@ -56,7 +35,7 @@ PyAbiInfo_GetInfo(void)
5635
goto error;
5736
}
5837

59-
value = _PyAbiInfo_GetPointerBits();
38+
value = PyLong_FromLong(sizeof(void *) * 8);
6039
if (value == NULL) {
6140
goto error;
6241
}

0 commit comments

Comments
 (0)