Skip to content

Commit 1e548bd

Browse files
committed
review suggestion
1 parent 88274d6 commit 1e548bd

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

Objects/longobject.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -222,19 +222,17 @@ _PyLong_FromMedium(sdigit x)
222222
assert(!IS_SMALL_INT(x));
223223
assert(is_medium_int(x));
224224

225-
// We use _Py_FREELIST_POP_MEM instead of _Py_FREELIST_POP because the new
226-
// reference is created in _PyObject_Init
227-
PyLongObject *v = (PyLongObject *)_Py_FREELIST_POP_MEM(ints);
225+
PyLongObject *v = (PyLongObject *)_Py_FREELIST_POP(PyLongObject, ints);
228226
if (v == NULL) {
229227
v = PyObject_Malloc(sizeof(PyLongObject));
230228
if (v == NULL) {
231229
PyErr_NoMemory();
232230
return NULL;
233231
}
232+
_PyObject_Init((PyObject*)v, &PyLong_Type);
234233
}
235234
digit abs_x = x < 0 ? -x : x;
236235
_PyLong_SetSignAndDigitCount(v, x<0?-1:1, 1);
237-
_PyObject_Init((PyObject*)v, &PyLong_Type);
238236
v->long_value.ob_digit[0] = abs_x;
239237
return (PyObject*)v;
240238
}

0 commit comments

Comments
 (0)