gruns / gruns/furl

ipv6 addresses now need to be valid in 3.9+

Open
#182 0 comments 0 reactions 0 assignees View on GitHub
Kind/Bug
Dominant language
Python
Stars
2.8k
Forks
165
PR merge metrics
No merged PRs in 30d

Description

`test_hosts` has a comment
```
# Invalid, but well-formed, IPv6 addresses shouldn't raise an
# exception because urlparse.urlsplit() doesn't raise an
# exception on invalid IPv6 addresses.
```

This I think is true in 3.8 and below, but not in 3.9 (3.9.21 tested) which now gets
```
ERROR: test_hosts (test_furl.TestFurl)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/palfrey/src/furl/tests/test_furl.py", line 1661, in test_hosts
furl.furl('http://[0:0:0:0:0:0:0:1:1:1:1:1:1:1:1:9999999999999]/')
File "/home/palfrey/src/furl/furl/furl.py", line 1381, in __init__
self.load(url) # Raises ValueError on invalid URL.
File "/home/palfrey/src/furl/furl/furl.py", line 1406, in load
tokens = urlsplit(url)
File "/home/palfrey/src/furl/furl/furl.py", line 312, in urlsplit
scheme, netloc, path, query, fragment = urllib.parse.urlsplit(url)
File "/home/palfrey/.local/share/uv/python/cpython-3.9.21-linux-x86_64-gnu/lib/python3.9/urllib/parse.py", line 510, in urlsplit
_check_bracketed_host(bracketed_host)
File "/home/palfrey/.local/share/uv/python/cpython-3.9.21-linux-x86_64-gnu/lib/python3.9/urllib/parse.py", line 453, in _check_bracketed_host
ip = ipaddress.ip_address(hostname) # Throws Value Error if not IPv6 or IPv4
File "/home/palfrey/.local/share/uv/python/cpython-3.9.21-linux-x86_64-gnu/lib/python3.9/ipaddress.py", line 53, in ip_address
raise ValueError(f'{address!r} does not appear to be an IPv4 or IPv6 address')
ValueError: '0:0:0:0:0:0:0:1:1:1:1:1:1:1:1:9999999999999' does not appear to be an IPv4 or IPv6 address
```
which is breaking the tests. Should these dummy addresses be set to something valid now?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.