mirror of
https://github.com/python/cpython.git
synced 2025-07-07 19:35:27 +00:00
gh-111375: Use NULL
rather than None
in the exception stack to indicate that an exception was handled (#113302)
This commit is contained in:
parent
1ff0238594
commit
a2dd0e7038
6 changed files with 9 additions and 7 deletions
|
@ -121,11 +121,11 @@ _PyErr_GetTopmostException(PyThreadState *tstate)
|
|||
_PyErr_StackItem *exc_info = tstate->exc_info;
|
||||
assert(exc_info);
|
||||
|
||||
while ((exc_info->exc_value == NULL || exc_info->exc_value == Py_None) &&
|
||||
exc_info->previous_item != NULL)
|
||||
while (exc_info->exc_value == NULL && exc_info->previous_item != NULL)
|
||||
{
|
||||
exc_info = exc_info->previous_item;
|
||||
}
|
||||
assert(!Py_IsNone(exc_info->exc_value));
|
||||
return exc_info;
|
||||
}
|
||||
|
||||
|
@ -592,7 +592,7 @@ PyErr_GetHandledException(void)
|
|||
void
|
||||
_PyErr_SetHandledException(PyThreadState *tstate, PyObject *exc)
|
||||
{
|
||||
Py_XSETREF(tstate->exc_info->exc_value, Py_XNewRef(exc));
|
||||
Py_XSETREF(tstate->exc_info->exc_value, Py_XNewRef(exc == Py_None ? NULL : exc));
|
||||
}
|
||||
|
||||
void
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue