Uh oh!
There was an error while loading. Please reload this page.
Do not IDNA-encode IPv6 literal hosts in to_uri() (#188) - #189
Conversation
mvaught02
commented
Feb 20, 2026
glyph
commented
Feb 21, 2026
ugh, looks like our CI needs some updates first, to catch up with more recent pythons and linuxes |
mvaught02
commented
Feb 21, 2026
Hmm, I can probably tackle this a couple of ways. When I opened this PR, I was trying to keep it low-touch in hopes we could get a quick release with the fix without dragging in a bunch of unrelated changes. I can stick with that theme and just “make it work” — update the Actions config to use a modern Python for the checks and switch the legacy test versions over to containers so they still run. I’m happy to wire that up in this PR. Or, if it makes more sense, I can either expand this PR to uplift the project to currently supported Python versions, or open a separate PR to handle that cleanup first and then we can merge this one afterward. I’m good either way — just let me know what you’d prefer and I can take care of it. At a glance this doesn’t seem like a major lift. Mostly just trying to get this fix in since it keeps coming back to annoy me 😅 |
glyph
commented
Feb 21, 2026
A separate PR for CI cleanup would be ideal. But this change is relatively small and I think uncontroversial so if you preferred to clean it up here I wouldn't complain too much. |
| deps = | ||
| black==21.7b0 | ||
| click<8.0 |
There was a problem hiding this comment.
When I ran this locally for tests I had to pin this back to get tests to work with older versions. This goes away when that other PR is merged.
Summary
This PR fixes a long-standing bug in
hyperlink.URL.to_uri()where plain IPv6 literal hosts (e.g., [::1]) are incorrectly passed toidna.encode().This bug was originally reported in #68 and #188 and affects downstream users (e.g., treq) even on current releases.