Skip to content

Validate eager decoding after a lazy wrapper is cached - #212

Open
pasmud wants to merge 1 commit into
python-hyper:masterfrom
pasmud:fix/eager-decoding-after-lazy-cache
Open

pasmud wants to merge 1 commit into
python-hyper:masterfrom
pasmud:fix/eager-decoding-after-lazy-cache

Conversation

@pasmud

@pasmud pasmud commented Nov 13, 2026

Copy link
Copy Markdown

Calling URL.get_decoded_url(lazy=True) caches a wrapper without decoding its fields. A later eager get_decoded_url() returns that wrapper without validation, so an invalid UTF-8 path such as https://example.com/%FF succeeds even though a fresh eager call raises UnicodeDecodeError.

Validate the cached wrapper's fields on eager calls, preserving its identity and lazy access. Two regression tests cover invalid UTF-8 across URL components, repeated eager failures and reuse of a valid cached wrapper.

Validation on Windows/Python3.13.1: 137 tests passed, including doctests and Hypothesis tests, with one existing Hypothesis deprecation warning. Both new regression methods fail before the fix. Black21.7b0 checks and git diff --check pass. Modern Flake8 reports the same ten diagnostics on the patch and unchanged source. The full tox matrix and other Python versions remain unverified.

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.

1 participant