mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
Issue #15604: Update uses of PyObject_IsTrue() to check for and handle errors correctly.
Patch by Serhiy Storchaka.
This commit is contained in:
parent
dd7c55250d
commit
6f430e4963
11 changed files with 87 additions and 39 deletions
|
@ -883,6 +883,7 @@ PySSL_peercert(PySSLSocket *self, PyObject *args)
|
|||
int len;
|
||||
int verification;
|
||||
PyObject *binary_mode = Py_None;
|
||||
int b;
|
||||
|
||||
if (!PyArg_ParseTuple(args, "|O:peer_certificate", &binary_mode))
|
||||
return NULL;
|
||||
|
@ -890,7 +891,10 @@ PySSL_peercert(PySSLSocket *self, PyObject *args)
|
|||
if (!self->peer_cert)
|
||||
Py_RETURN_NONE;
|
||||
|
||||
if (PyObject_IsTrue(binary_mode)) {
|
||||
b = PyObject_IsTrue(binary_mode);
|
||||
if (b < 0)
|
||||
return NULL;
|
||||
if (b) {
|
||||
/* return cert in DER-encoded format */
|
||||
|
||||
unsigned char *bytes_buf = NULL;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue