diff options
| author | Victor Stinner <victor.stinner@gmail.com> | 2013-10-31 15:00:24 +0100 |
|---|---|---|
| committer | Victor Stinner <victor.stinner@gmail.com> | 2013-10-31 15:00:24 +0100 |
| commit | ba9be477b0098eefeae2dd36e9261434d83bfb57 (patch) | |
| tree | 95d883b8116c04ecfc423dbb98002d304a961ab2 | |
| parent | ae233eab5cc9a932a80063003602fd0a62e4be05 (diff) | |
| download | cpython-git-ba9be477b0098eefeae2dd36e9261434d83bfb57.tar.gz | |
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.
| -rw-r--r-- | Modules/_ssl.c | 6 |
1 files changed, 5 insertions, 1 deletions
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)) |
