• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

aio-libs / yarl / 36461803082
98%

Build:
DEFAULT BRANCH: master
Ran 28 Sep 2026 05:59PM UTC
Jobs 1
Files 43
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

28 Sep 2026 05:57PM UTC coverage: 97.633% (+0.03%) from 97.602%
36461803082

push

github

web-flow
Reject special-scheme hosts that end in a number after a name (#1933)

<!-- Thank you for your contribution! -->

## What do these changes do?

For the special schemes (`http`, `https`, `ws`, `wss`, `ftp`, `file`),
the WHATWG URL Standard runs a host whose last label is a number
(`foo.123`, `💩.123`, `example.0x1f`) through its IPv4 parser, which
fails when another label is not a number. yarl accepted such hosts as a
reg-name. In the default WHATWG mode they are now rejected with
`ValueError` by `URL()`, `URL.build()` (both `host=` and `authority=`)
and `with_host()`, and when `with_scheme()`, `join()` with a `//host`
reference or `URL(url, mode="whatwg")` move such a host into a
special-scheme WHATWG URL; `mode="rfc"` keeps accepting them, since RFC
3986 allows them as a reg-name. Percent-encoded hosts are left alone:
yarl does not decode hosts, so it cannot tell which labels WHATWG would
see.

Hosts made only of numbers, such as `1.2.3`, `0x7f.1`, `256.1.1.1` or
the 50-digit host aiohttp uses in its tests, keep their current
behaviour: WHATWG would reinterpret or reject some of them, but changing
that is a separate decision and would break aiohttp's test suite.

## Are there changes in behavior for the user?

Yes, hence the `breaking` fragment: `URL("http://foo.123/")` raises in
the default mode. Other schemes and RFC mode are unchanged.

## Is it a substantial burden for the maintainers to support this?

No. The "ends in a number after a name" flag is computed inside the
cached `_encode_host()`, which now returns it next to the encoded host,
so a cached build or `with_host()` only unpacks the pair and tests the
flag.

## Related issue number

N/A; found by the conformance report in #1923.

## Checklist

- [x] I think the code is well written
- [x] Unit tests for the changes exist
- [x] Documentation reflects the changes
- [ ] If you provide code modification, please add yourself to
`CONTRIBUTORS.txt`
- [x] Add a new news fragment into the `CHANGES/`... (continued)

96 of 192 branches covered (50.0%)

Branch coverage included in aggregate %.

122 of 122 new or added lines in 2 files covered. (100.0%)

8688 of 8805 relevant lines covered (98.67%)

0.99 hits per line

Jobs
ID Job ID Ran Files Coverage
1 MyPy - 36461803082.1 28 Sep 2026 05:59PM UTC 43
97.63
GitHub Action Run
Source Files on build 36461803082
  • Tree
  • List 43
  • Changed 1
  • Source Changed 1
  • Coverage Changed 1
Coverage ∆ File Lines Relevant Covered Missed Hits/Line Branch Hits Branch Misses
  • Back to Repo
  • Github Actions Build #36461803082
  • 4088b177 on github
  • Prev Build on master (#36456042200)
  • Next Build on master (#36471421231)
  • Delete
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc