Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ba9be47

Browse files
committed
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.
1 parent ae233ea commit ba9be47

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

Modules/_ssl.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -346,14 +346,18 @@ fill_and_set_sslerror(PyObject *type, int ssl_errno, const char *errstr,
346346
lib_obj, errstr, lineno);
347347
else
348348
msg = PyUnicode_FromFormat("%s (_ssl.c:%d)", errstr, lineno);
349-
350349
if (msg == NULL)
351350
goto fail;
351+
352352
init_value = Py_BuildValue("iN", ssl_errno, msg);
353+
if (init_value == NULL)
354+
goto fail;
355+
353356
err_value = PyObject_CallObject(type, init_value);
354357
Py_DECREF(init_value);
355358
if (err_value == NULL)
356359
goto fail;
360+
357361
if (reason_obj == NULL)
358362
reason_obj = Py_None;
359363
if (_PyObject_SetAttrId(err_value, &PyId_reason, reason_obj))

0 commit comments

Comments
 (0)