mirror of
https://github.com/python/cpython.git
synced 2025-09-03 23:41:18 +00:00
bpo-38858: Reorganize pycore_init_types() (GH-17265)
* Call _PyLong_Init() and _PyExc_Init() earlier * new_interpreter() reuses pycore_init_types()
This commit is contained in:
parent
ac2235432c
commit
ef5aa9af7c
1 changed files with 11 additions and 20 deletions
|
@ -565,19 +565,15 @@ pycore_init_types(void)
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!_PyLong_Init()) {
|
||||||
|
return _PyStatus_ERR("can't init longs");
|
||||||
|
}
|
||||||
|
|
||||||
status = _PyUnicode_Init();
|
status = _PyUnicode_Init();
|
||||||
if (_PyStatus_EXCEPTION(status)) {
|
if (_PyStatus_EXCEPTION(status)) {
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_PyStructSequence_Init() < 0) {
|
|
||||||
return _PyStatus_ERR("can't initialize structseq");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!_PyLong_Init()) {
|
|
||||||
return _PyStatus_ERR("can't init longs");
|
|
||||||
}
|
|
||||||
|
|
||||||
status = _PyExc_Init();
|
status = _PyExc_Init();
|
||||||
if (_PyStatus_EXCEPTION(status)) {
|
if (_PyStatus_EXCEPTION(status)) {
|
||||||
return status;
|
return status;
|
||||||
|
@ -587,8 +583,8 @@ pycore_init_types(void)
|
||||||
return _PyStatus_ERR("can't init float");
|
return _PyStatus_ERR("can't init float");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!_PyContext_Init()) {
|
if (_PyStructSequence_Init() < 0) {
|
||||||
return _PyStatus_ERR("can't init context");
|
return _PyStatus_ERR("can't initialize structseq");
|
||||||
}
|
}
|
||||||
|
|
||||||
status = _PyErr_Init();
|
status = _PyErr_Init();
|
||||||
|
@ -596,6 +592,10 @@ pycore_init_types(void)
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!_PyContext_Init()) {
|
||||||
|
return _PyStatus_ERR("can't init context");
|
||||||
|
}
|
||||||
|
|
||||||
return _PyStatus_OK();
|
return _PyStatus_OK();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1447,16 +1447,7 @@ new_interpreter(PyThreadState **tstate_p)
|
||||||
}
|
}
|
||||||
config = &interp->config;
|
config = &interp->config;
|
||||||
|
|
||||||
status = _PyExc_Init();
|
status = pycore_init_types();
|
||||||
if (_PyStatus_EXCEPTION(status)) {
|
|
||||||
return status;
|
|
||||||
}
|
|
||||||
|
|
||||||
status = _PyErr_Init();
|
|
||||||
if (_PyStatus_EXCEPTION(status)) {
|
|
||||||
return status;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* XXX The following is lax in error checking */
|
/* XXX The following is lax in error checking */
|
||||||
PyObject *modules = PyDict_New();
|
PyObject *modules = PyDict_New();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue