-
-
Notifications
You must be signed in to change notification settings - Fork 34.2k
bpo-39164: errors: add and expose _PyErr_GetExcInfo #17752
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Add a private ``_PyErr_GetExcInfo()`` function to retrieve exception information of the specified Python thread state. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -433,21 +433,27 @@ PyErr_Clear(void) | |
|
|
||
|
|
||
| void | ||
| PyErr_GetExcInfo(PyObject **p_type, PyObject **p_value, PyObject **p_traceback) | ||
| _PyErr_GetExcInfo(PyThreadState *tstate, | ||
| PyObject **p_type, PyObject **p_value, PyObject **p_traceback) | ||
| { | ||
| PyThreadState *tstate = _PyThreadState_GET(); | ||
|
|
||
| _PyErr_StackItem *exc_info = _PyErr_GetTopmostException(tstate); | ||
| *p_type = exc_info->exc_type; | ||
| *p_value = exc_info->exc_value; | ||
| *p_traceback = exc_info->exc_traceback; | ||
|
|
||
|
|
||
| Py_XINCREF(*p_type); | ||
| Py_XINCREF(*p_value); | ||
| Py_XINCREF(*p_traceback); | ||
| } | ||
|
|
||
|
|
||
| void | ||
| PyErr_GetExcInfo(PyObject **p_type, PyObject **p_value, PyObject **p_traceback) | ||
| { | ||
| PyThreadState *tstate = _PyThreadState_GET(); | ||
| return _PyErr_GetExcInfo(tstate, p_type, p_value, p_traceback); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should this have a
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You're right. I wrote PR #18010 to fix the warning. |
||
| } | ||
|
|
||
| void | ||
| PyErr_SetExcInfo(PyObject *p_type, PyObject *p_value, PyObject *p_traceback) | ||
| { | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.