Skip to content

Commit 6e6ff76

Browse files
committed
Address review: drop redundant test comments, rename data_fast to data_tuple
The per-test comments duplicated the class docstring; the class-level description is enough. Rename data_fast to data_tuple since the value is now built by PySequence_Tuple(), so the old name was misleading.
1 parent 838183b commit 6e6ff76

2 files changed

Lines changed: 6 additions & 12 deletions

File tree

Lib/test/test_socket.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7503,9 +7503,6 @@ class ReentrantMutationTests(unittest.TestCase):
75037503
@unittest.skipUnless(hasattr(socket.socket, "sendmsg"),
75047504
"sendmsg not supported")
75057505
def test_sendmsg_reentrant_data_mutation(self):
7506-
# Test that sendmsg() handles re-entrant mutation of data buffers
7507-
# via __buffer__ protocol.
7508-
# See: https://github.com/python/cpython/issues/143988
75097506
seq = []
75107507

75117508
class MutBuffer:
@@ -7528,9 +7525,6 @@ def __buffer__(self, flags):
75287525
@unittest.skipUnless(hasattr(socket.socket, "recvmsg_into"),
75297526
"recvmsg_into not supported")
75307527
def test_recvmsg_into_reentrant_buffer_mutation(self):
7531-
# Test that recvmsg_into() handles re-entrant mutation of buffers
7532-
# via __buffer__ protocol.
7533-
# See: https://github.com/python/cpython/issues/143988
75347528
seq = []
75357529
buf1 = bytearray(100)
75367530

Modules/socketmodule.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4851,19 +4851,19 @@ sock_sendmsg_iovec(PySocketSockObject *s, PyObject *data_arg,
48514851
Py_ssize_t ndataparts, ndatabufs = 0;
48524852
int result = -1;
48534853
struct iovec *iovs = NULL;
4854-
PyObject *data_fast = NULL;
4854+
PyObject *data_tuple = NULL;
48554855
Py_buffer *databufs = NULL;
48564856

48574857
/* Fill in an iovec for each message part, and save the Py_buffer
48584858
structs to release afterwards. */
4859-
data_fast = PySequence_Tuple(data_arg);
4860-
if (data_fast == NULL) {
4859+
data_tuple = PySequence_Tuple(data_arg);
4860+
if (data_tuple == NULL) {
48614861
PyErr_SetString(PyExc_TypeError,
48624862
"sendmsg() argument 1 must be an iterable");
48634863
goto finally;
48644864
}
48654865

4866-
ndataparts = PyTuple_GET_SIZE(data_fast);
4866+
ndataparts = PyTuple_GET_SIZE(data_tuple);
48674867
if (ndataparts > INT_MAX) {
48684868
PyErr_SetString(PyExc_OSError, "sendmsg() argument 1 is too long");
48694869
goto finally;
@@ -4885,7 +4885,7 @@ sock_sendmsg_iovec(PySocketSockObject *s, PyObject *data_arg,
48854885
}
48864886
}
48874887
for (; ndatabufs < ndataparts; ndatabufs++) {
4888-
if (PyObject_GetBuffer(PyTuple_GET_ITEM(data_fast, ndatabufs),
4888+
if (PyObject_GetBuffer(PyTuple_GET_ITEM(data_tuple, ndatabufs),
48894889
&databufs[ndatabufs], PyBUF_SIMPLE) < 0)
48904890
goto finally;
48914891
iovs[ndatabufs].iov_base = databufs[ndatabufs].buf;
@@ -4895,7 +4895,7 @@ sock_sendmsg_iovec(PySocketSockObject *s, PyObject *data_arg,
48954895
finally:
48964896
*databufsout = databufs;
48974897
*ndatabufsout = ndatabufs;
4898-
Py_XDECREF(data_fast);
4898+
Py_XDECREF(data_tuple);
48994899
return result;
49004900
}
49014901

0 commit comments

Comments
 (0)