mirror of
https://github.com/python/cpython.git
synced 2025-08-30 05:35:08 +00:00
Py_Initialize(): Now that standard exceptions are builtin, we don't
need two phase init or fini of the builtin module. Change the call of _PyBuiltin_Init_1() to _PyBuiltin_Init(). Add a call to init_exceptions(). Py_Finalize(): Don't call _PyBuiltin_Fini_1(). Instead call fini_exceptions() but move this to before the thread state is cleared.
This commit is contained in:
parent
c094ac856f
commit
f242aa0d1e
1 changed files with 11 additions and 11 deletions
|
@ -152,7 +152,7 @@ Py_Initialize()
|
||||||
|
|
||||||
_PyCompareState_Key = PyString_InternFromString("cmp_state");
|
_PyCompareState_Key = PyString_InternFromString("cmp_state");
|
||||||
|
|
||||||
bimod = _PyBuiltin_Init_1();
|
bimod = _PyBuiltin_Init();
|
||||||
if (bimod == NULL)
|
if (bimod == NULL)
|
||||||
Py_FatalError("Py_Initialize: can't initialize __builtin__");
|
Py_FatalError("Py_Initialize: can't initialize __builtin__");
|
||||||
interp->builtins = PyModule_GetDict(bimod);
|
interp->builtins = PyModule_GetDict(bimod);
|
||||||
|
@ -170,8 +170,10 @@ Py_Initialize()
|
||||||
|
|
||||||
_PyImport_Init();
|
_PyImport_Init();
|
||||||
|
|
||||||
|
/* initialize builtin exceptions */
|
||||||
|
init_exceptions();
|
||||||
|
|
||||||
/* phase 2 of builtins */
|
/* phase 2 of builtins */
|
||||||
_PyBuiltin_Init_2(interp->builtins);
|
|
||||||
_PyImport_FixupExtension("__builtin__", "__builtin__");
|
_PyImport_FixupExtension("__builtin__", "__builtin__");
|
||||||
|
|
||||||
initsigs(); /* Signal handling stuff, including initintr() */
|
initsigs(); /* Signal handling stuff, including initintr() */
|
||||||
|
@ -218,9 +220,6 @@ Py_Finalize()
|
||||||
/* Disable signal handling */
|
/* Disable signal handling */
|
||||||
PyOS_FiniInterrupts();
|
PyOS_FiniInterrupts();
|
||||||
|
|
||||||
/* Destroy PyExc_MemoryErrorInst */
|
|
||||||
_PyBuiltin_Fini_1();
|
|
||||||
|
|
||||||
/* Cleanup Unicode implementation */
|
/* Cleanup Unicode implementation */
|
||||||
_PyUnicode_Fini();
|
_PyUnicode_Fini();
|
||||||
|
|
||||||
|
@ -252,17 +251,18 @@ Py_Finalize()
|
||||||
}
|
}
|
||||||
#endif /* Py_TRACE_REFS */
|
#endif /* Py_TRACE_REFS */
|
||||||
|
|
||||||
/* Delete current thread */
|
|
||||||
PyInterpreterState_Clear(interp);
|
|
||||||
PyThreadState_Swap(NULL);
|
|
||||||
PyInterpreterState_Delete(interp);
|
|
||||||
|
|
||||||
/* Now we decref the exception classes. After this point nothing
|
/* Now we decref the exception classes. After this point nothing
|
||||||
can raise an exception. That's okay, because each Fini() method
|
can raise an exception. That's okay, because each Fini() method
|
||||||
below has been checked to make sure no exceptions are ever
|
below has been checked to make sure no exceptions are ever
|
||||||
raised.
|
raised.
|
||||||
*/
|
*/
|
||||||
_PyBuiltin_Fini_2();
|
fini_exceptions();
|
||||||
|
|
||||||
|
/* Delete current thread */
|
||||||
|
PyInterpreterState_Clear(interp);
|
||||||
|
PyThreadState_Swap(NULL);
|
||||||
|
PyInterpreterState_Delete(interp);
|
||||||
|
|
||||||
PyMethod_Fini();
|
PyMethod_Fini();
|
||||||
PyFrame_Fini();
|
PyFrame_Fini();
|
||||||
PyCFunction_Fini();
|
PyCFunction_Fini();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue