diff options
author | Guido van Rossum <guido@python.org> | 2000-12-01 13:13:11 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2000-12-01 13:13:11 (GMT) |
commit | e4dad905d440c211ca2eec90ea3ee5bdd3a0f66e (patch) | |
tree | 9be221909f3f20843d0c654e3c1f9afc71d57d03 /Modules | |
parent | 60a1e7fc9982489f6923371b1080818ead44db4a (diff) | |
download | cpython-e4dad905d440c211ca2eec90ea3ee5bdd3a0f66e.zip cpython-e4dad905d440c211ca2eec90ea3ee5bdd3a0f66e.tar.gz cpython-e4dad905d440c211ca2eec90ea3ee5bdd3a0f66e.tar.bz2 |
Patch by Michael Hudson to clarify the error message from
getsockaddrarg when the address is not a tuple.
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/socketmodule.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c index 6582713..e9b3aad 100644 --- a/Modules/socketmodule.c +++ b/Modules/socketmodule.c @@ -605,7 +605,13 @@ getsockaddrarg(PySocketSockObject *s, PyObject *args, struct sockaddr **addr_ret char *host; int port; addr=(struct sockaddr_in*)&(s->sock_addr).in; - if (!PyArg_Parse(args, "(si)", &host, &port)) + if (!PyTuple_Check(args)) { + PyErr_Format(PyExc_TypeError, + "getsockaddrarg: AF_INET address must be tuple, not %.500s", + args->ob_type->tp_name); + return 0; + } + if (!PyArg_ParseTuple(args, "si:getsockaddrarg", &host, &port)) return 0; if (setipaddr(host, addr) < 0) return 0; |