Skip to content

Preserve explicitly empty URI authorities - #159

Open
ac1982 wants to merge 1 commit into
python-hyper:mainfrom
ac1982:fix/preserve-empty-authority
Open

ac1982 wants to merge 1 commit into
python-hyper:mainfrom
ac1982:fix/preserve-empty-authority

Conversation

@ac1982

@ac1982 ac1982 commented Oct 8, 2026 •

Copy link
Copy Markdown

Fixes #78.

An explicitly empty authority is currently collapsed into an absent authority: urlparse('foo:///').unsplit() returns foo:/, and file:///tmp/a loses its // delimiter. Preserve the distinction between '' and None through URI/IRI construction, normalization, reassembly, and ParseResult conversions. from_parts() still treats an omitted host as an absent authority, while an explicitly empty host preserves //.

Add regression coverage for round trips, copies, normalization, string/byte conversions, and relative resolution, including controls for absent authorities. This addresses the empty-authority case independently of #155's authority-absent paths beginning with // and #156's dot-segment normalization.

Validation on Linux with Python 3.12:

  • Initial regression run against the base: 18 failures, 4 passes.
  • Final complete suite: 2,938 passed; 100% coverage, including 24 new cases.
  • All pre-commit checks passed; HTML documentation build and all 57 doctests passed.
  • Wheel and sdist builds passed.
  • The project typing-coverage check passed (75% required). Standalone Pyright is not clean on the base: the same tool reports 56 errors / 6 warnings on the base and 55 errors / 6 warnings here. The removed error is the nullable byte-authority conversion fixed by this change; no new error messages were introduced.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Empty (but present) authority component lost

1 participant