summaryrefslogtreecommitdiff
path: root/Modules/_functoolsmodule.c
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2017-03-30 09:09:41 +0300
committerGitHub <noreply@github.com>2017-03-30 09:09:41 +0300
commitba85d69a3e3610bdd05f0dd372cf4ebca178c7fb (patch)
treefe0766c34601880610c3399a8f01c35ab6e8fe8e /Modules/_functoolsmodule.c
parente6911a44f69c0d302db60f49952a9cf69da69a2b (diff)
downloadcpython-git-ba85d69a3e3610bdd05f0dd372cf4ebca178c7fb.tar.gz
bpo-29878: Add global instances of int for 0 and 1. (#852)
Diffstat (limited to 'Modules/_functoolsmodule.c')
-rw-r--r--Modules/_functoolsmodule.c9
1 files changed, 1 insertions, 8 deletions
diff --git a/Modules/_functoolsmodule.c b/Modules/_functoolsmodule.c
index 567300e3f3..da1d2e16db 100644
--- a/Modules/_functoolsmodule.c
+++ b/Modules/_functoolsmodule.c
@@ -529,15 +529,8 @@ keyobject_richcompare(PyObject *ko, PyObject *other, int op)
PyObject *y;
PyObject *compare;
PyObject *answer;
- static PyObject *zero;
PyObject* stack[2];
- if (zero == NULL) {
- zero = PyLong_FromLong(0);
- if (!zero)
- return NULL;
- }
-
if (Py_TYPE(other) != &keyobject_type){
PyErr_Format(PyExc_TypeError, "other argument must be K instance");
return NULL;
@@ -561,7 +554,7 @@ keyobject_richcompare(PyObject *ko, PyObject *other, int op)
return NULL;
}
- answer = PyObject_RichCompare(res, zero, op);
+ answer = PyObject_RichCompare(res, _PyLong_Zero, op);
Py_DECREF(res);
return answer;
}