GH-101578: Normalize the current exception (GH-101607)

* Make sure that the current exception is always normalized.

* Remove redundant type and traceback fields for the current exception.

* Add new API functions: PyErr_GetRaisedException, PyErr_SetRaisedException

* Add new API functions: PyException_GetArgs, PyException_SetArgs
This commit is contained in:
Mark Shannon 2023-02-08 09:31:12 +00:00 committed by GitHub
parent 027adf42cd
commit feec49c407
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
29 changed files with 477 additions and 172 deletions

4
PC/python3dll.c generated
View file

@ -198,6 +198,7 @@ EXPORT_FUNC(PyErr_Format)
EXPORT_FUNC(PyErr_FormatV)
EXPORT_FUNC(PyErr_GetExcInfo)
EXPORT_FUNC(PyErr_GetHandledException)
EXPORT_FUNC(PyErr_GetRaisedException)
EXPORT_FUNC(PyErr_GivenExceptionMatches)
EXPORT_FUNC(PyErr_NewException)
EXPORT_FUNC(PyErr_NewExceptionWithDoc)
@ -227,6 +228,7 @@ EXPORT_FUNC(PyErr_SetInterrupt)
EXPORT_FUNC(PyErr_SetInterruptEx)
EXPORT_FUNC(PyErr_SetNone)
EXPORT_FUNC(PyErr_SetObject)
EXPORT_FUNC(PyErr_SetRaisedException)
EXPORT_FUNC(PyErr_SetString)
EXPORT_FUNC(PyErr_SyntaxLocation)
EXPORT_FUNC(PyErr_SyntaxLocationEx)
@ -255,9 +257,11 @@ EXPORT_FUNC(PyEval_ReleaseThread)
EXPORT_FUNC(PyEval_RestoreThread)
EXPORT_FUNC(PyEval_SaveThread)
EXPORT_FUNC(PyEval_ThreadsInitialized)
EXPORT_FUNC(PyException_GetArgs)
EXPORT_FUNC(PyException_GetCause)
EXPORT_FUNC(PyException_GetContext)
EXPORT_FUNC(PyException_GetTraceback)
EXPORT_FUNC(PyException_SetArgs)
EXPORT_FUNC(PyException_SetCause)
EXPORT_FUNC(PyException_SetContext)
EXPORT_FUNC(PyException_SetTraceback)