◐ Shell
clean mode source ↗

bpo-35713: Reorganize sys module initialization by vstinner · Pull Request #11658 · python/cpython

@vstinner

Reorganize Python initialization to get working exceptions and
sys.stderr earlier. Changes:

* Add _PySys_SetPreliminaryStderr(). Preliminary sys.stderr is now
  set earlier to get an usable sys.stderr ealier.
* Split _PyExc_Init(): create a new _PyBuiltins_AddExceptions()
  function.
* Call _PyExc_Init() earlier in _Py_InitializeCore_impl()
  and new_interpreter() to get working exceptions earlier.
* Split _Py_InitializeCore_impl() into subfunctions: add multiple
  pycore_init_xxx() functions
* Move code into _Py_Initialize_ReconfigureCore() to be able to call
  it from _Py_InitializeCore().
* Rename _Py_ReadyTypes() to _PyTypes_Init().
* Rename _PySys_BeginInit() to _PySys_InitCore()
* Rename _PySys_EndInit() to _PySys_InitMain()
* Add _PySys_Create(). It calls _PySys_InitCore() which becomes
  private.
* Misc code cleanup