mirror of
https://github.com/python/cpython.git
synced 2025-12-08 06:10:17 +00:00
[3.9] gh-98793: Fix typecheck in overlapped.c (GH-98835) (GH-98890) (GH-140825)
(cherry picked from commit d3d1738acd)
Co-authored-by: Charlie Zhao <zhaoyu_hit@qq.com>
Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
This commit is contained in:
parent
42762bb098
commit
798eaca665
3 changed files with 17 additions and 3 deletions
|
|
@ -279,6 +279,17 @@ def threadMain():
|
|||
stop.set()
|
||||
thr.join()
|
||||
|
||||
def test_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
|
||||
with self.assertRaises(TypeError):
|
||||
proactor.connect(sock, bad_address)
|
||||
with self.assertRaises(TypeError):
|
||||
proactor.sendto(sock, b'abc', addr=bad_address)
|
||||
sock.close()
|
||||
|
||||
|
||||
class WinPolicyTests(WindowsEventsTestCase):
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1 @@
|
|||
Fix argument typechecks in :func:`!_overlapped.WSAConnect` and :func:`!_overlapped.Overlapped.WSASendTo` functions.
|
||||
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue