mirror of
https://github.com/python/cpython.git
synced 2025-10-09 16:34:44 +00:00
gh-114570: Add PythonFinalizationError exception (#115352)
Add PythonFinalizationError exception. This exception derived from RuntimeError is raised when an operation is blocked during the Python finalization. The following functions now raise PythonFinalizationError, instead of RuntimeError: * _thread.start_new_thread() * subprocess.Popen * os.fork() * os.fork1() * os.forkpty() Morever, _winapi.Overlapped finalizer now logs an unraisable PythonFinalizationError, instead of an unraisable RuntimeError.
This commit is contained in:
parent
326119d373
commit
3e7b7df5cb
13 changed files with 55 additions and 6 deletions
|
@ -2177,6 +2177,10 @@ SimpleExtendsException(PyExc_Exception, RuntimeError,
|
|||
SimpleExtendsException(PyExc_RuntimeError, RecursionError,
|
||||
"Recursion limit exceeded.");
|
||||
|
||||
// PythonFinalizationError extends RuntimeError
|
||||
SimpleExtendsException(PyExc_RuntimeError, PythonFinalizationError,
|
||||
"Operation blocked during Python finalization.");
|
||||
|
||||
/*
|
||||
* NotImplementedError extends RuntimeError
|
||||
*/
|
||||
|
@ -3641,6 +3645,7 @@ static struct static_exception static_exceptions[] = {
|
|||
ITEM(KeyError), // base: LookupError(Exception)
|
||||
ITEM(ModuleNotFoundError), // base: ImportError(Exception)
|
||||
ITEM(NotImplementedError), // base: RuntimeError(Exception)
|
||||
ITEM(PythonFinalizationError), // base: RuntimeError(Exception)
|
||||
ITEM(RecursionError), // base: RuntimeError(Exception)
|
||||
ITEM(UnboundLocalError), // base: NameError(Exception)
|
||||
ITEM(UnicodeError), // base: ValueError(Exception)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue