A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2007-March/072267.html below:

[Python-Dev] Adding timeout to socket.py and httplib.py

[Python-Dev] Adding timeout to socket.py and httplib.pyAlan Kennedy python-dev at alan.kennedy.name
Thu Mar 22 14:22:00 CET 2007
[Alan]
>> - Explicitly check that the address passed is a tuple of (string, integer)

[Facundo]
> In the code, I'll just make "host, port = address", I don't think it
> will be a problem at all. Remember that this function primary use is for
> higher level libraries, and that "address" in socket enviroment is
> always, always, (host, port).

It's rather unfortunate that the tuple needs to be unpacked at all.

Instead, it should be possible to simply pass the address tuple
directly to the socsket.getaddrinfo() function, and let it worry about
the tuple-ness of the address, raising exceptions accordingly.

The socket.getaddrinfo() function, unlike every other python socket
function, takes separate host and port parameters. Which forces every
user of the socket.getaddrinfo function to do the same unnecessary and
potentially error-prone address tuple unpacking.

I have raised a feature request to change this.

[1685962] socket.getaddrinfo() should take an address tuple.

Regards,

Alan.
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4