[issue33206] Windows inet_pton(socket.AF_INET6, 'localhost') raises ValueError instead of socket.error

2018-04-02 Thread Vitaly Kruglikov

Vitaly Kruglikov  added the comment:

Indeed, confirmed no `inet_pton()` on Windows in Python 2.7 :(.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33206] Windows inet_pton(socket.AF_INET6, 'localhost') raises ValueError instead of socket.error

2018-04-02 Thread Vitaly Kruglikov

Vitaly Kruglikov  added the comment:

Zachary, thank you for noticing that Twisted is involved. inet_pton definitely 
exists on Windows 2.7.14, but it turns out that Twisted monkey-patches it if 
`socket.inet_pton(socket.AF_INET6, "::")` fails.

Aha! - but this suggests that Window's Python 2.7.14 implementation of 
`socket.inet_pton()` has a bug in that it fails to recognize '::' as the the 
IPv6 unspecified address 0:0:0:0:0:0:0:0, so `socket.inet_pton(socket.AF_INET6, 
"::")` fails. I wonder if this exists on Windows Python3 implementations?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33206] Windows inet_pton(socket.AF_INET6, 'localhost') raises ValueError instead of socket.error

2018-04-02 Thread Zachary Ware

Zachary Ware  added the comment:

Your traceback seems to include both pika and twisted, and as best I can tell, 
`socket.inet_pton` does not exist on Windows in Python 2.7.  If I've diagnosed 
this incorrectly, please reopen the ticket with a reproducer that does not 
depend on pika or twisted.

--
resolution:  -> third party
stage:  -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33206] Windows inet_pton(socket.AF_INET6, 'localhost') raises ValueError instead of socket.error

2018-04-02 Thread Vitaly Kruglikov

Vitaly Kruglikov  added the comment:

This behavior goes against the socket documentation 
https://docs.python.org/2/library/socket.html which states "Supported values 
for address_family are currently AF_INET and AF_INET6. If the IP address string 
ip_string is invalid, *socket.error* will be raised."

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33206] Windows inet_pton(socket.AF_INET6, 'localhost') raises ValueError instead of socket.error

2018-04-02 Thread Vitaly Kruglikov

Change by Vitaly Kruglikov :


--
type:  -> behavior

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33206] Windows inet_pton(socket.AF_INET6, 'localhost') raises ValueError instead of socket.error

2018-04-02 Thread Vitaly Kruglikov

New submission from Vitaly Kruglikov :

I am seeing this with `socket.AF_INET6` on Windows running python 2.7.14
```
[00:02:33]   File "C:\projects\pika\pika\adapters\host_tcp_connector.py", line 
153, in _check_already_resolved
[00:02:33] socket.inet_pton(socket.AF_INET6, 'localhost')
[00:02:33]   File "C:\Python27\lib\site-packages\twisted\python\compat.py", 
line 68, in inet_pton
[00:02:33] raise ValueError("Illegal characters: %r" % (''.join(x),))
[00:02:33] ValueError: Illegal characters: 't'
```

With `socket.AF_INET`, `socket.inet_pton(socket.AF_INET, 'localhost')` raises 
`socket.error` as expected.

For comparison, with Python 2.7.10 running on OS X, both AF_INET and AF_INET6 
raise `socket.error`.

--
components: Library (Lib), Windows
messages: 314814
nosy: paul.moore, steve.dower, tim.golden, vitaly.krug, zach.ware
priority: normal
severity: normal
status: open
title: Windows inet_pton(socket.AF_INET6, 'localhost') raises ValueError 
instead of socket.error
versions: Python 2.7

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com