mirror of
https://github.com/python/cpython.git
synced 2025-12-04 00:30:19 +00:00
bpo-43687: Py_Initialize() creates singletons earlier (GH-25147)
Reorganize pycore_interp_init() to initialize singletons before the the first PyType_Ready() call. Fix an issue when Python is configured using --without-doc-strings.
This commit is contained in:
parent
58384c6ab0
commit
442ad74fc2
8 changed files with 138 additions and 95 deletions
|
|
@ -18,8 +18,8 @@ static inline PyObject* __PyLong_GetSmallInt_internal(int value)
|
|||
assert(-_PY_NSMALLNEGINTS <= value && value < _PY_NSMALLPOSINTS);
|
||||
size_t index = _PY_NSMALLNEGINTS + value;
|
||||
PyObject *obj = (PyObject*)interp->small_ints[index];
|
||||
// _PyLong_GetZero() and _PyLong_GetOne() must not be called
|
||||
// before _PyLong_Init() nor after _PyLong_Fini()
|
||||
// _PyLong_GetZero(), _PyLong_GetOne() and get_small_int() must not be
|
||||
// called before _PyLong_Init() nor after _PyLong_Fini().
|
||||
assert(obj != NULL);
|
||||
return obj;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue