summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2020-10-27 20:34:33 (GMT)
committerGitHub <noreply@github.com>2020-10-27 20:34:33 (GMT)
commitc310185c081110741fae914c06c7aaf673ad3d0d (patch)
treead2e40e44a63818789a06ee92ff79ed603693e22 /Objects
parent0564aafb71a153dd0aca4b9266dfae9336a4f2cb (diff)
downloadcpython-c310185c081110741fae914c06c7aaf673ad3d0d.zip
cpython-c310185c081110741fae914c06c7aaf673ad3d0d.tar.gz
cpython-c310185c081110741fae914c06c7aaf673ad3d0d.tar.bz2
bpo-42161: Remove private _PyLong_Zero and _PyLong_One (GH-23003)
Use PyLong_FromLong(0) and PyLong_FromLong(1) of the public C API instead. For Python internals, _PyLong_GetZero() and _PyLong_GetOne() of pycore_long.h can be used.
Diffstat (limited to 'Objects')
-rw-r--r--Objects/longobject.c18
1 files changed, 0 insertions, 18 deletions
diff --git a/Objects/longobject.c b/Objects/longobject.c
index ae63eba..e0d6410 100644
--- a/Objects/longobject.c
+++ b/Objects/longobject.c
@@ -32,9 +32,6 @@ _Py_IDENTIFIER(big);
(Py_SIZE(x) == 0 ? (sdigit)0 : \
(sdigit)(x)->ob_digit[0]))
-PyObject *_PyLong_Zero = NULL;
-PyObject *_PyLong_One = NULL;
-
#define IS_SMALL_INT(ival) (-NSMALLNEGINTS <= (ival) && (ival) < NSMALLPOSINTS)
#define IS_SMALL_UINT(ival) ((ival) < NSMALLPOSINTS)
@@ -5723,16 +5720,6 @@ _PyLong_Init(PyThreadState *tstate)
}
if (_Py_IsMainInterpreter(tstate)) {
- _PyLong_Zero = PyLong_FromLong(0);
- if (_PyLong_Zero == NULL) {
- return 0;
- }
-
- _PyLong_One = PyLong_FromLong(1);
- if (_PyLong_One == NULL) {
- return 0;
- }
-
/* initialize int_info */
if (Int_InfoType.tp_name == NULL) {
if (PyStructSequence_InitType2(&Int_InfoType, &int_info_desc) < 0) {
@@ -5747,11 +5734,6 @@ _PyLong_Init(PyThreadState *tstate)
void
_PyLong_Fini(PyThreadState *tstate)
{
- if (_Py_IsMainInterpreter(tstate)) {
- Py_CLEAR(_PyLong_One);
- Py_CLEAR(_PyLong_Zero);
- }
-
for (Py_ssize_t i = 0; i < NSMALLNEGINTS + NSMALLPOSINTS; i++) {
Py_CLEAR(tstate->interp->small_ints[i]);
}