summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2013-10-31 14:00:24 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2013-10-31 14:00:24 (GMT)
commitba9be477b0098eefeae2dd36e9261434d83bfb57 (patch)
tree95d883b8116c04ecfc423dbb98002d304a961ab2 /Modules
parentae233eab5cc9a932a80063003602fd0a62e4be05 (diff)
downloadcpython-ba9be477b0098eefeae2dd36e9261434d83bfb57.zip
cpython-ba9be477b0098eefeae2dd36e9261434d83bfb57.tar.gz
cpython-ba9be477b0098eefeae2dd36e9261434d83bfb57.tar.bz2
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.
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_ssl.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/Modules/_ssl.c b/Modules/_ssl.c
index 34a141b..ffcc4a9 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))