mirror of
https://github.com/python/cpython.git
synced 2025-07-15 23:35:23 +00:00
In makesockaddr(), if we don't know the address family, don't raise an
exception -- return it as a tuple. Seems useful in promiscuous mode.
This commit is contained in:
parent
8b4c98783d
commit
aa948df877
1 changed files with 6 additions and 3 deletions
|
@ -364,9 +364,12 @@ BUILD_FUNC_DEF_2(makesockaddr,struct sockaddr *,addr, int,addrlen)
|
|||
/* More cases here... */
|
||||
|
||||
default:
|
||||
PyErr_SetString(PySocket_Error,
|
||||
"return unknown socket address type");
|
||||
return NULL;
|
||||
/* If we don't know the address family, don't raise an
|
||||
exception -- return it as a tuple. */
|
||||
return Py_BuildValue("is#",
|
||||
addr->sa_family,
|
||||
addr->sa_data,
|
||||
sizeof(addr->sa_data));
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue