Commit b6918cdb authored by Victor Stinner's avatar Victor Stinner

Issue #19437: Fix fill_and_set_sslerror() of _ssl, handle Py_BuildValue()

failure

Don't call PyObject_CallObject() with NULL parameters and an exception set.
parent 76e69955
...@@ -346,14 +346,18 @@ fill_and_set_sslerror(PyObject *type, int ssl_errno, const char *errstr, ...@@ -346,14 +346,18 @@ fill_and_set_sslerror(PyObject *type, int ssl_errno, const char *errstr,
lib_obj, errstr, lineno); lib_obj, errstr, lineno);
else else
msg = PyUnicode_FromFormat("%s (_ssl.c:%d)", errstr, lineno); msg = PyUnicode_FromFormat("%s (_ssl.c:%d)", errstr, lineno);
if (msg == NULL) if (msg == NULL)
goto fail; goto fail;
init_value = Py_BuildValue("iN", ssl_errno, msg); init_value = Py_BuildValue("iN", ssl_errno, msg);
if (init_value == NULL)
goto fail;
err_value = PyObject_CallObject(type, init_value); err_value = PyObject_CallObject(type, init_value);
Py_DECREF(init_value); Py_DECREF(init_value);
if (err_value == NULL) if (err_value == NULL)
goto fail; goto fail;
if (reason_obj == NULL) if (reason_obj == NULL)
reason_obj = Py_None; reason_obj = Py_None;
if (_PyObject_SetAttrId(err_value, &PyId_reason, reason_obj)) if (_PyObject_SetAttrId(err_value, &PyId_reason, reason_obj))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment