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

aio-libs / yarl / 37026618109
98%

Build:
DEFAULT BRANCH: master
Ran 02 Oct 2026 03:25PM UTC
Jobs 1
Files 53
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

02 Oct 2026 03:23PM UTC coverage: 97.868% (+0.005%) from 97.863%
37026618109

push

github

web-flow
Keep an empty userinfo in RFC 3986 mode (#1966)

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

## What do these changes do?

RFC 3986 section 3.2 keeps `userinfo "@"` when the userinfo is empty,
and section 6.2.3 does not remove it, but yarl dropped the "@" in RFC
3986 mode as well: `URL("http://@www.example.com", mode="rfc")` printed
`http://www.example.com`. RFC mode now keeps an empty userinfo, and
`URL.user`/`URL.raw_user` are `""` there whenever the URL has a userinfo
with an empty username (`http://@h`, `http://:@h`, `http://:p@h`), with
`None` meaning no userinfo. So `URL("http://@h", mode="rfc") !=
URL("http://h", mode="rfc")`, and `URL(str(u), mode="rfc") == u` holds.
Parsing, `URL.build()` (both `user=` and `authority=`), `with_user("")`,
`with_password()`, `with_host()`, `with_port()`, `with_scheme()` and
`join()` follow the same rule; moving an RFC URL into WHATWG mode drops
the empty userinfo. WHATWG mode is unchanged.

`split_netloc()` keeps its single string cache key; RFC mode uses a
separately cached `split_netloc_rfc()`. `make_netloc()` now writes "@"
for any user that is not `None`, and WHATWG callers pass `None` for an
empty user.

Conformance report: three rows moved from "RFC mode differs from RFC
3986+3987, WHATWG mode follows WHATWG" to "yarl follows each standard in
its mode": `http://@www.example.com`, `http://@pple.com` and `sc://@/`
(the last has the same root cause: the empty userinfo was dropped
together with the "@" of an empty host). `sc://:/` stays where it is; it
has no userinfo, and the empty host plus empty port dropping the
authority is a separate issue. No row moved the other way and "yarl
differs, RFC 3986+3987 and WHATWG agree" stays empty.

Existing tests updated because they pinned the old RFC behaviour:
`tests/test_url.py::test_empty_password_without_user` (`user` is `""`),
`tests/test_url_parsing.py::TestStripEmptyParts::test_all_empty_rfc`
(`//@:?#` keeps its authority `@`, so the path is `/` as for any
author... (continued)

97 of 194 branches covered (50.0%)

Branch coverage included in aggregate %.

222 of 226 new or added lines in 6 files covered. (98.23%)

11056 of 11202 relevant lines covered (98.7%)

0.99 hits per line

Uncovered Changes

Lines Coverage ∆ File
4
97.89
tests/test_url_userinfo_rfc.py
Jobs
ID Job ID Ran Files Coverage
1 MyPy - 37026618109.1 02 Oct 2026 03:25PM UTC 53
97.87
GitHub Action Run
Source Files on build 37026618109
  • Tree
  • List 53
  • Changed 5
  • Source Changed 5
  • Coverage Changed 4
Coverage ∆ File Lines Relevant Covered Missed Hits/Line Branch Hits Branch Misses
  • Back to Repo
  • Github Actions Build #37026618109
  • 89450910 on github
  • Prev Build on master (#37020030388)
  • Next Build on master (#37047257842)
  • 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