diff options
Diffstat (limited to 'Modules/_testcapimodule.c')
-rw-r--r-- | Modules/_testcapimodule.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/Modules/_testcapimodule.c b/Modules/_testcapimodule.c index 5302641a9a..808483ebd7 100644 --- a/Modules/_testcapimodule.c +++ b/Modules/_testcapimodule.c @@ -6868,29 +6868,36 @@ test_buildvalue_issue38913(PyObject *self, PyObject *Py_UNUSED(ignored)) PyObject *res; const char str[] = "string"; const Py_UNICODE unicode[] = L"unicode"; - PyErr_SetNone(PyExc_ZeroDivisionError); + assert(!PyErr_Occurred()); res = Py_BuildValue("(s#O)", str, 1, Py_None); assert(res == NULL); - if (!PyErr_ExceptionMatches(PyExc_ZeroDivisionError)) { + if (!PyErr_ExceptionMatches(PyExc_SystemError)) { return NULL; } + PyErr_Clear(); + res = Py_BuildValue("(z#O)", str, 1, Py_None); assert(res == NULL); - if (!PyErr_ExceptionMatches(PyExc_ZeroDivisionError)) { + if (!PyErr_ExceptionMatches(PyExc_SystemError)) { return NULL; } + PyErr_Clear(); + res = Py_BuildValue("(y#O)", str, 1, Py_None); assert(res == NULL); - if (!PyErr_ExceptionMatches(PyExc_ZeroDivisionError)) { + if (!PyErr_ExceptionMatches(PyExc_SystemError)) { return NULL; } + PyErr_Clear(); + res = Py_BuildValue("(u#O)", unicode, 1, Py_None); assert(res == NULL); - if (!PyErr_ExceptionMatches(PyExc_ZeroDivisionError)) { + if (!PyErr_ExceptionMatches(PyExc_SystemError)) { return NULL; } - PyErr_Clear(); + + Py_RETURN_NONE; } |