Skip to content

Commit 7dc1de3

Browse files
Address review comments
Restore freeing the buffer allocated by the "et" format in gethostbyaddr(), remove the empty block left after the Py_buffer converter took over releasing the initialization vector in sendmsg_afalg(), and use the bool converter in setblocking().
1 parent cbf38e7 commit 7dc1de3

2 files changed

Lines changed: 15 additions & 16 deletions

File tree

Modules/clinic/socketmodule.c.h

Lines changed: 9 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Modules/socketmodule.c

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3176,7 +3176,7 @@ _socket_socket__accept_impl(PySocketSockObject *s)
31763176
/*[clinic input]
31773177
_socket.socket.setblocking
31783178
self as s: self(type="PySocketSockObject *")
3179-
flag as arg: object
3179+
flag: bool
31803180
/
31813181
31823182
Set the socket to blocking (flag is true) or non-blocking (false).
@@ -3186,17 +3186,11 @@ setblocking(False) is equivalent to settimeout(0.0).
31863186
[clinic start generated code]*/
31873187

31883188
static PyObject *
3189-
_socket_socket_setblocking_impl(PySocketSockObject *s, PyObject *arg)
3190-
/*[clinic end generated code: output=39a348904324f352 input=115fee5787faedac]*/
3189+
_socket_socket_setblocking_impl(PySocketSockObject *s, int flag)
3190+
/*[clinic end generated code: output=0d27b1c391538401 input=bfc2c8564d8b67f6]*/
31913191
{
3192-
long block;
3193-
3194-
block = PyObject_IsTrue(arg);
3195-
if (block < 0)
3196-
return NULL;
3197-
3198-
s->sock_timeout = _PyTime_FromSeconds(block ? -1 : 0);
3199-
if (internal_setblocking(s, block) == -1) {
3192+
s->sock_timeout = _PyTime_FromSeconds(flag ? -1 : 0);
3193+
if (internal_setblocking(s, flag) == -1) {
32003194
return NULL;
32013195
}
32023196
Py_RETURN_NONE;
@@ -5349,8 +5343,6 @@ _socket_socket_sendmsg_afalg_impl(PySocketSockObject *self,
53495343

53505344
finally:
53515345
PyMem_Free(controlbuf);
5352-
if (iv->buf != NULL) {
5353-
}
53545346
PyMem_Free(msg.msg_iov);
53555347
for (i = 0; i < ndatabufs; i++) {
53565348
PyBuffer_Release(&databufs[i]);
@@ -6425,6 +6417,7 @@ _socket_gethostbyaddr(PyObject *module, PyObject *hobj)
64256417
PyMutex_Unlock(&netdb_lock);
64266418
#endif
64276419
finally:
6420+
PyMem_Free(ip_num);
64286421
return ret;
64296422
}
64306423
#endif

0 commit comments

Comments
 (0)