mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
bpo-38858: Small integer per interpreter (GH-17315)
Each Python subinterpreter now has its own "small integer singletons": numbers in [-5; 257] range. It is no longer possible to change the number of small integers at build time by overriding NSMALLNEGINTS and NSMALLPOSINTS macros: macros should now be modified manually in pycore_pystate.h header file. For now, continue to share _PyLong_Zero and _PyLong_One singletons between all subinterpreters.
This commit is contained in:
parent
f501db2b93
commit
630c8df5cf
5 changed files with 57 additions and 38 deletions
|
@ -576,10 +576,11 @@ pycore_init_types(PyThreadState *tstate)
|
|||
if (_PyStatus_EXCEPTION(status)) {
|
||||
return status;
|
||||
}
|
||||
}
|
||||
|
||||
if (!_PyLong_Init()) {
|
||||
return _PyStatus_ERR("can't init longs");
|
||||
}
|
||||
|
||||
if (!_PyLong_Init(tstate)) {
|
||||
return _PyStatus_ERR("can't init longs");
|
||||
}
|
||||
|
||||
if (is_main_interp) {
|
||||
|
@ -1251,7 +1252,11 @@ finalize_interp_types(PyThreadState *tstate, int is_main_interp)
|
|||
_PyList_Fini();
|
||||
_PySet_Fini();
|
||||
_PyBytes_Fini();
|
||||
_PyLong_Fini();
|
||||
}
|
||||
|
||||
_PyLong_Fini(tstate);
|
||||
|
||||
if (is_main_interp) {
|
||||
_PyFloat_Fini();
|
||||
_PyDict_Fini();
|
||||
_PySlice_Fini();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue