diff options
author | Guido van Rossum <guido@python.org> | 1997-05-07 17:41:48 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1997-05-07 17:41:48 (GMT) |
commit | aa948df877db10abbb252232b22ba26a1ad5534d (patch) | |
tree | d542936b6b2c2c5491967577bef30de447ff46e5 /Modules | |
parent | 8b4c98783d49d26f546fe9bea78087c64baa5a5f (diff) | |
download | cpython-aa948df877db10abbb252232b22ba26a1ad5534d.zip cpython-aa948df877db10abbb252232b22ba26a1ad5534d.tar.gz cpython-aa948df877db10abbb252232b22ba26a1ad5534d.tar.bz2 |
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.
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/socketmodule.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c index 7b73b63..bcc3fb2 100644 --- a/Modules/socketmodule.c +++ b/Modules/socketmodule.c @@ -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)); } } |