[Python-checkins] cpython: Issue #19437: Fix fill_and_set_sslerror() of _ssl, handle Py_BuildValue()

victor.stinner python-checkins at python.org
Thu Oct 31 17:23:55 CET 2013


http://hg.python.org/cpython/rev/1181fcc02fe7
changeset:   86803:1181fcc02fe7
user:        Victor Stinner <victor.stinner at gmail.com>
date:        Thu Oct 31 15:00:24 2013 +0100
summary:
  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.

files:
  Modules/_ssl.c |  6 +++++-
  1 files changed, 5 insertions(+), 1 deletions(-)


diff --git a/Modules/_ssl.c b/Modules/_ssl.c
--- a/Modules/_ssl.c
+++ b/Modules/_ssl.c
@@ -346,14 +346,18 @@
                                    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))

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list