[New-bugs-announce] [issue41169] socket.inet_pton raised when pass an IPv6 address like "[::]" to it

Wator Sead report at bugs.python.org
Tue Jun 30 10:06:11 EDT 2020


New submission from Wator Sead <seahoh at gmail.com>:

3.6:

>>> import socket
>>> socket.inet_pton(socket.AF_INET6,'[::]')
b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'


3.7 and above:

>>> import socket
>>> socket.inet_pton(socket.AF_INET6,'[::]')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
OSError: illegal IP address string passed to inet_pton


Both:

>>> import socket
>>> addr = '[::1]', 888
>>> ls = socket.socket(socket.AF_INET6)
>>> cs = socket.socket(socket.AF_INET6)
>>> ls.bind(addr)  # no raise
>>> ls.listen(1)
>>> cs.connect(addr)  # no raise

----------
components: Library (Lib)
messages: 372694
nosy: seahoh
priority: normal
severity: normal
status: open
title: socket.inet_pton raised when pass an IPv6 address like "[::]" to it
type: behavior
versions: Python 3.7, Python 3.8

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue41169>
_______________________________________


More information about the New-bugs-announce mailing list