mirror of
https://github.com/python/cpython.git
synced 2025-08-31 14:07:50 +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... */
|
/* More cases here... */
|
||||||
|
|
||||||
default:
|
default:
|
||||||
PyErr_SetString(PySocket_Error,
|
/* If we don't know the address family, don't raise an
|
||||||
"return unknown socket address type");
|
exception -- return it as a tuple. */
|
||||||
return NULL;
|
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