Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions Lib/test/test_asyncio/test_windows_events.py
Original file line numberDiff line numberDiff line change
Expand Up@@ -279,6 +279,17 @@ def threadMain():
stop.set()
thr.join()

deftest_address_argument_type_error(self):
# Regression test for https://github.com/python/cpython/issues/98793
proactor=self.loop._proactor
sock=socket.socket(type=socket.SOCK_DGRAM)
bad_address=None
withself.assertRaises(TypeError):
proactor.connect(sock, bad_address)
withself.assertRaises(TypeError):
proactor.sendto(sock, b'abc', addr=bad_address)
sock.close()


classWinPolicyTests(WindowsEventsTestCase):

Expand Down
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
Fix argument typechecks in :func:`!_overlapped.WSAConnect` and :func:`!_overlapped.Overlapped.WSASendTo` functions.
8 changes: 5 additions & 3 deletions Modules/overlapped.c
Original file line numberDiff line numberDiff line change
Expand Up@@ -1552,7 +1552,9 @@ overlapped_WSAConnect(PyObject *self, PyObject *args)
int Length;
int err;

if (!PyArg_ParseTuple(args, F_HANDLE "O", &ConnectSocket, &AddressObj)){

if (!PyArg_ParseTuple(args, F_HANDLE "O!:WSAConnect",
&ConnectSocket, &PyTuple_Type, &AddressObj)){
return NULL;
}

Expand DownExpand Up@@ -1598,8 +1600,8 @@ Overlapped_WSASendTo(OverlappedObject *self, PyObject *args)
int ret;
DWORD err;

if (!PyArg_ParseTuple(args, F_HANDLE "O" F_DWORD "O",
&handle, &bufobj, &flags, &AddressObj))
if (!PyArg_ParseTuple(args, F_HANDLE "OkO!:WSASendTo",
&handle, &bufobj, &flags, &PyTuple_Type, &AddressObj))
{
return NULL;
}
Expand Down
Loading