Ben Darnell <ben.darn...@gmail.com> added the comment:

To summarize the justification, this patch does two things: it moves an 
optimization from create_connection to getaddrinfo, which makes it apply to 
more callers (including Tornado), and it makes the code simpler and less 
redundant (net reduction of 47 non-test lines in the patch). 

As far as we can tell, the reason it wasn't done this way in the first place is 
that at the time getaddrinfo held a global lock on some platforms, but this is 
no longer true. If there's still some locking in or around getaddrinfo on some 
platforms (or some libc implementations), this patch would be a bad idea. Is 
there a good way to test for that? I suppose we could set up a 
deliberately-slow DNS server and try to call getaddrinfo with AI_NUMERICHOST 
while another thread is blocked talking to that server, but that seems like a 
lot of test infrastructure to build out.

----------
nosy: +Ben.Darnell

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

Reply via email to