diff options
author | Gregory P. Smith <greg@krypto.org> | 2017-01-18 00:54:56 (GMT) |
---|---|---|
committer | Gregory P. Smith <greg@krypto.org> | 2017-01-18 00:54:56 (GMT) |
commit | 8128d5a491fdacd40b4cc0dcf54ef8c61f264fb8 (patch) | |
tree | ed4a43b247435d46529533f5ba8bc3a603d23f1c /Modules | |
parent | aeaf29460889cca7258c19dc942a04294abc3353 (diff) | |
download | cpython-8128d5a491fdacd40b4cc0dcf54ef8c61f264fb8.zip cpython-8128d5a491fdacd40b4cc0dcf54ef8c61f264fb8.tar.gz cpython-8128d5a491fdacd40b4cc0dcf54ef8c61f264fb8.tar.bz2 |
Address a minor Coverity warning re: unchecked PyArg_ParseTuple calls
in socket.sendto(). A PyErr_Occurred() check was happening later, but
it is better to just use the return value and not call PyErr_Occurred().
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/socketmodule.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c index d5506a6..274769d 100644 --- a/Modules/socketmodule.c +++ b/Modules/socketmodule.c @@ -3863,11 +3863,15 @@ sock_sendto(PySocketSockObject *s, PyObject *args) arglen = PyTuple_Size(args); switch (arglen) { case 2: - PyArg_ParseTuple(args, "y*O:sendto", &pbuf, &addro); + if (!PyArg_ParseTuple(args, "y*O:sendto", &pbuf, &addro)) { + return NULL; + } break; case 3: - PyArg_ParseTuple(args, "y*iO:sendto", - &pbuf, &flags, &addro); + if (!PyArg_ParseTuple(args, "y*iO:sendto", + &pbuf, &flags, &addro)) { + return NULL; + } break; default: PyErr_Format(PyExc_TypeError, @@ -3875,8 +3879,6 @@ sock_sendto(PySocketSockObject *s, PyObject *args) arglen); return NULL; } - if (PyErr_Occurred()) - return NULL; if (!IS_SELECTABLE(s)) { PyBuffer_Release(&pbuf); |