From ba85d69a3e3610bdd05f0dd372cf4ebca178c7fb Mon Sep 17 00:00:00 2001 From: Serhiy Storchaka Date: Thu, 30 Mar 2017 09:09:41 +0300 Subject: bpo-29878: Add global instances of int for 0 and 1. (#852) --- Objects/enumobject.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) (limited to 'Objects/enumobject.c') diff --git a/Objects/enumobject.c b/Objects/enumobject.c index 480768fbde..3eb1736200 100644 --- a/Objects/enumobject.c +++ b/Objects/enumobject.c @@ -100,7 +100,6 @@ enum_traverse(enumobject *en, visitproc visit, void *arg) static PyObject * enum_next_long(enumobject *en, PyObject* next_item) { - static PyObject *one = NULL; PyObject *result = en->en_result; PyObject *next_index; PyObject *stepped_up; @@ -110,14 +109,9 @@ enum_next_long(enumobject *en, PyObject* next_item) if (en->en_longindex == NULL) return NULL; } - if (one == NULL) { - one = PyLong_FromLong(1); - if (one == NULL) - return NULL; - } next_index = en->en_longindex; assert(next_index != NULL); - stepped_up = PyNumber_Add(next_index, one); + stepped_up = PyNumber_Add(next_index, _PyLong_One); if (stepped_up == NULL) return NULL; en->en_longindex = stepped_up; -- cgit v1.2.1