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

Vitaly Kruglikov report at bugs.python.org
Mon Apr 2 13:18:03 EDT 2018


New submission from Vitaly Kruglikov <vitaly.krug at gmail.com>:

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 <report at bugs.python.org>
<https://bugs.python.org/issue33206>
_______________________________________


More information about the Python-bugs-list mailing list