mirror of
https://github.com/python/cpython.git
synced 2025-11-01 18:51:43 +00:00
Store actual ints, not pointers to them in the interpreter state. (GH-29274)
This commit is contained in:
parent
13d9205f40
commit
4fc68560ea
5 changed files with 10 additions and 21 deletions
|
|
@ -17,7 +17,7 @@ static inline PyObject* __PyLong_GetSmallInt_internal(int value)
|
|||
PyInterpreterState *interp = _PyInterpreterState_GET();
|
||||
assert(-_PY_NSMALLNEGINTS <= value && value < _PY_NSMALLPOSINTS);
|
||||
size_t index = _PY_NSMALLNEGINTS + value;
|
||||
PyObject *obj = (PyObject*)interp->small_ints[index];
|
||||
PyObject *obj = (PyObject*)&interp->small_ints[index];
|
||||
// _PyLong_GetZero(), _PyLong_GetOne() and get_small_int() must not be
|
||||
// called before _PyLong_Init() nor after _PyLong_Fini().
|
||||
assert(obj != NULL);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue