Skip to content

Commit 56590f8

Browse files
authored
gh-144493: Improve error message in _overlapped.BindLocal() (#144495)
Replace a confusing error message with one that actually explains what the error is in `_overlapped.BindLocal()`. Fixes: #144493
1 parent 957f9fe commit 56590f8

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Improve an exception error message in ``_overlapped.BindLocal()`` that is raised when :meth:`asyncio.loop.sock_connect` is called on a :class:`asyncio.ProactorEventLoop` with a socket that has an invalid address family.

Modules/overlapped.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -559,7 +559,7 @@ _overlapped_BindLocal_impl(PyObject *module, HANDLE Socket, int Family)
559559
ret = bind((SOCKET)Socket, (SOCKADDR*)&addr, sizeof(addr))
560560
!= SOCKET_ERROR;
561561
} else {
562-
PyErr_SetString(PyExc_ValueError, "expected tuple of length 2 or 4");
562+
PyErr_SetString(PyExc_ValueError, "Only AF_INET and AF_INET6 families are supported");
563563
return NULL;
564564
}
565565

0 commit comments

Comments
 (0)