Thanks to visit codestin.com
Credit goes to github.com

Skip to content

bpo-42161: Remove private _PyLong_Zero and _PyLong_One #23003

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 27, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions Include/longobject.h
Original file line number Diff line number Diff line change
Expand Up @@ -210,9 +210,6 @@ PyAPI_FUNC(PyObject *) _PyLong_GCD(PyObject *, PyObject *);
#endif /* !Py_LIMITED_API */

#ifndef Py_LIMITED_API
PyAPI_DATA(PyObject *) _PyLong_Zero;
PyAPI_DATA(PyObject *) _PyLong_One;

PyAPI_FUNC(PyObject *) _PyLong_Rshift(PyObject *, size_t);
PyAPI_FUNC(PyObject *) _PyLong_Lshift(PyObject *, size_t);
#endif
Expand Down
18 changes: 0 additions & 18 deletions Objects/longobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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) {
Expand All @@ -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]);
}
Expand Down
2 changes: 0 additions & 2 deletions Tools/c-analyzer/TODO
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,6 @@ Objects/bytesobject.c:nullstring static PyBytesO
Objects/codeobject.c:PyCode_NewEmpty():nulltuple static PyObject *nulltuple
Objects/dictobject.c:empty_values static PyObject *empty_values[1]
Objects/listobject.c:indexerr static PyObject *indexerr
Objects/longobject.c:_PyLong_One PyObject *_PyLong_One
Objects/longobject.c:_PyLong_Zero PyObject *_PyLong_Zero
Objects/longobject.c:small_ints static PyLongObject small_ints[NSMALLNEGINTS + NSMALLPOSINTS]
Objects/setobject.c:emptyfrozenset static PyObject *emptyfrozenset
Python/context.c:_token_missing static PyObject *_token_missing
Expand Down