Re: [Python-Dev] httplib c. timeouts and global state

2008-03-26 Thread Alan Kennedy
[This message will not be threaded properly since I wasn't subscribed at the time the original was sent] [John] What I found in the archive is this thread (sorry for the non-python.org URL): http://www.gossamer-threads.com/lists/python/dev/555039?do=post_view_threaded#555039 In that

[Python-Dev] Return error codes from getaddrinfo.

2007-06-27 Thread Alan Kennedy
Dear all, I'm seeking enlightenment on the error codes returned by the socket.getaddrinfo() function. Consider the following on python 2.5 on Windows import urllib urllib.urlopen(http://nonexistent;) [snip traceback] IOError: [Errno socket error] (11001, 'getaddrinfo failed') So the

[Python-Dev] Return value from socket.fileno()

2007-05-23 Thread Alan Kennedy
Dear all, I am writing to seek information about the socket.fileno() method, and opinions on how best to implement it on jython. On cpython, socket.fileno() returns a file descriptor, i.e. an integer index into an array of file objects. This integer is then passed to select.select and

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

2007-03-22 Thread Alan Kennedy
[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

Re: [Python-Dev] I vote to reject: Adding timeout to socket.py and httplib.py.

2007-03-21 Thread Alan Kennedy
[Facundo Batista] Remember that this function primary use is for higher level libraries Yes, I see that clearly now. But remember that by adding a new function to the socket module to support httplib et al, you are also adding a function to the socket module that will be used directly by end

Re: [Python-Dev] I vote to reject: Adding timeout to socket.py and httplib.py.

2007-03-21 Thread Alan Kennedy
[Facundo] Voting is open, ;) So what are we voting on exactly? The patch as it currently is? The patch has not been updated to reflect recent discussions on the list. Will the patch be updated before the vote? I have one more issue with the patch. I think that the exception handling in the

Re: [Python-Dev] I vote to reject: Adding timeout to socket.py and httplib.py.

2007-03-21 Thread Alan Kennedy
[Facundo] Talk is cheap. I'm sorry if you see my attempts to review your patch as cheap talk. Maybe I should have just kept my opinion to myself. You'll get your chance to return the favour when I check in my upcoming 1000+ line change to jython 2.3 to bring the jython socket, select and

Re: [Python-Dev] I vote to reject: Adding timeout to socket.py and httplib.py.

2007-03-21 Thread Alan Kennedy
[Facundo] Talk is cheap. I'm sorry if you see my attempts to review your patch as cheap talk. Maybe I should have just kept my opinion to myself. You'll get your chance to return the favour when I check in my upcoming 1000+ line change to jython 2.3 to bring the jython socket, select and

Re: [Python-Dev] I vote to reject: Adding timeout to socket.py and httplib.py.

2007-03-21 Thread Alan Kennedy
[Josiah] In regards to 'there is no way to create a blocking socket this way', Alan is off his rocker. I am not off my rocker. And I never wrote the words you place in quotes (except in relation to an earlier defect in the patch where the timeout=None value was ignored). What I clearly stated

Re: [Python-Dev] I vote to reject: Adding timeout to socket.py and httplib.py.

2007-03-21 Thread Alan Kennedy
[Greg Ewing] or d) Put it in another module Is it time for a sockettools module, maybe? +1! Alan. ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe:

Re: [Python-Dev] I vote to reject: Adding timeout to socket.py and httplib.py.

2007-03-21 Thread Alan Kennedy
[Facundo] Talk is cheap. I'm sorry if you see my attempts to review your patch as cheap talk. Maybe I should have just kept my opinion to myself. You'll get your chance to return the favour when I check in my upcoming 1000+ line change to jython 2.3 to bring the jython socket, select and

Re: [Python-Dev] Non-blocking sockets, asynchronous connects and select.select.

2007-03-20 Thread Alan Kennedy
Thanks Josiah and Neal, you were right. I am running the code on Windows, Server 2003. I should have mentioned that at the start. When I change the hostname from to localhost, the code works exactly as expected. It's odd that this behaviour exists, only on Windows. The jython code that I'm

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

2007-03-20 Thread Alan Kennedy
[Facundo Batista] Do you have any news about this? Re: Patch 1676823 http://sourceforge.net/tracker/index.php?func=detailaid=1676823group_id=5470atid=305470 Since I've just written a lot of socket stuff for jython, I thought I'd have a look at the patch. I like the idea of adding better socket

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

2007-03-20 Thread Alan Kennedy
[Alan Kennedy] I see that your updated socket.connect() method takes a timeout parameter, which defaults to None if not present, e.g. [Facundo Batista] I did NOT update a connect() method. I created a connect() function, in the module socket.py (there's also a connect() method in the socket

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

2007-03-20 Thread Alan Kennedy
[Facundo] But, I recognize that maybe it's [connect] not the best name. What about create_connection? I have no strong feelings about it, other than to say it should not be connect. How about * connect_to_server() * open_connection() * open_client_connection() There's no need to include

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

2007-03-20 Thread Alan Kennedy
[Facundo] So, I have two modifications to make to the patch: - change the name to create_connection - make timeout obligatory named I was going to suggest a third change: for orthogonality with the API for socket objects, add a blocking parameter as well, i.e. def create_connection(address,

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

2007-03-20 Thread Alan Kennedy
[Josiah] But now the result could be either an error code OR a socket. One of the reasons to provide a timeout for the create_connection call, if I understand correctly, is to handle cases for which you don't get a response back in sufficient time. AFAICT, that's the only reason. It's not to

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

2007-03-20 Thread Alan Kennedy
[Facundo] Letting timeout be positional or named, it's just less error prone. So, if I can make it this way, it's what I prefer, :) So, if I want a timeout of, say, 80 seconds, I issue a call like this new_socket = socket.create_connection(address, 80) So is that address = host, port = 80?

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

2007-03-20 Thread Alan Kennedy
[Josiah] Error-wise, I agree that it would be better to pass timeout explicitly with a keyword, but generally users will notice their mistake if they try to do create_connection(host, port) by ValueError(tuple expected as first argument, got str instead) Is it better than

[Python-Dev] Non-blocking sockets, asynchronous connects and select.select.

2007-03-19 Thread Alan Kennedy
Dear all, I'm working on a select implementation for jython (in combination with non-blocking sockets), and a set of unit tests for same. I decided to run all of the non-blocking unit tests, both server and client side, in the same thread; seems to be a reasonable thing to do. After all,