R. David Murray added the comment:

OK, I reviewed the issue enough to remember:  If socket.setdefaulttimeout is 
never called, then the default timeout is None (no timeout).  Since 
socket.setdefaulttimeout is deprecated, the global default should always be 
None.  Therefore, if you want to use the "default" timeout in a new 
application, you could pass None as the value for timeout...but of course that 
probably doesn't do what you want.  What you *really* want to do is pass the 
default timeout value being used by your application, whatever that is, managed 
however your application/library manages it.

If you are writing a library that for some reason wants to retain backward 
compatibility with setdefaulttimeout (and I think you probably shouldn't be), 
you could call getdefaulttimeout to get the current default value.  Since 
urlopen is creating a new socket object, this should have the correct semantics.

Mind, I don't claim that there can't be a better solution, I'm just trying to 
explain the current state of affairs as I understand it.  However, aside from 
the ugliness of the current signature for urlopen, at the moment it seems 
reasonable to me :)

That said, this argument is premised firmly on setdefaulttimeout being 
deprecated, and there is currently no indication of that in its documentation 
that I can see.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue18417>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to