From: Victor Stinner Date: Thu, 31 Oct 2013 14:00:24 +0000 (+0100) Subject: Issue #19437: Fix fill_and_set_sslerror() of _ssl, handle Py_BuildValue() X-Git-Tag: v3.4.0b1~452 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ba9be477b0098eefeae2dd36e9261434d83bfb57;p=python 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. --- diff --git a/Modules/_ssl.c b/Modules/_ssl.c index 34a141bd27..ffcc4a9f61 100644 --- a/Modules/_ssl.c +++ b/Modules/_ssl.c @@ -346,14 +346,18 @@ fill_and_set_sslerror(PyObject *type, int ssl_errno, const char *errstr, lib_obj, errstr, lineno); else msg = PyUnicode_FromFormat("%s (_ssl.c:%d)", errstr, lineno); - if (msg == NULL) goto fail; + init_value = Py_BuildValue("iN", ssl_errno, msg); + if (init_value == NULL) + goto fail; + err_value = PyObject_CallObject(type, init_value); Py_DECREF(init_value); if (err_value == NULL) goto fail; + if (reason_obj == NULL) reason_obj = Py_None; if (_PyObject_SetAttrId(err_value, &PyId_reason, reason_obj))