Skip to content

Fix test_invalid_idna for idna 3.11 compatibility#12036

Merged
Dreamsorcerer merged 1 commit intoaio-libs:masterfrom
rodrigobnogueira:fix/test-invalid-idna-3.11
Feb 15, 2026
Merged

Fix test_invalid_idna for idna 3.11 compatibility#12036
Dreamsorcerer merged 1 commit intoaio-libs:masterfrom
rodrigobnogueira:fix/test-invalid-idna-3.11

Conversation

@rodrigobnogueira
Copy link
Copy Markdown
Member

@rodrigobnogueira rodrigobnogueira commented Feb 5, 2026

What do these changes do?

  • Replace \u2061 (FUNCTION APPLICATION) with \u0080 (PAD character) in test
  • idna 3.11 now silently removes \u2061 instead of raising an exception
  • \u0080 is rejected by yarl during URL construction and correctly raises InvalidURL
  • Pin idna==3.11

Are there changes in behavior for the user?

No. This is a test-only fix with no impact on user-facing behavior.

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

No. This is a minimal change that updates a single test character and pins the idna dependency to ensure compatibility with the latest version. The fix is straightforward and does not introduce any new complexity.

Related issue number

Fixes #12027

Checklist

  • I think the code is well written
  • Unit tests for the changes exist
  • Documentation reflects the changes
  • If you provide code modification, please add yourself to CONTRIBUTORS.txt
  • Add a new news fragment into the CHANGES/ folder

@psf-chronographer psf-chronographer bot added the bot:chronographer:provided There is a change note present in this PR label Feb 5, 2026
@codspeed-hq
Copy link
Copy Markdown

codspeed-hq bot commented Feb 5, 2026

CodSpeed Performance Report

Merging this PR will not alter performance

Comparing rodrigobnogueira:fix/test-invalid-idna-3.11 (07921b1) with master (4bb9e6e)

Summary

✅ 59 untouched benchmarks

- Replace \u2061 (FUNCTION APPLICATION) with \u0080 (PAD character) in test
- idna 3.11 silently removes \u2061 instead of raising an exception
- \u0080 is rejected by yarl during URL construction and correctly raises InvalidURL
- Pin idna>=3.11 in runtime-deps.in and regenerate requirements files

Fixes aio-libs#12027
@rodrigobnogueira rodrigobnogueira force-pushed the fix/test-invalid-idna-3.11 branch from 2a65dbb to 07921b1 Compare February 6, 2026 01:20
@rodrigobnogueira
Copy link
Copy Markdown
Member Author

CI is failing due to flaky test (see #11992)

=========================== short test summary info ============================
XFAIL tests/test_http_parser.py::test_http_response_parser_strict_headers[py-parser-pyloop] - Py parser is lenient. May update py-parser later.
FAILED tests/test_imports.py::test_import_time - assert 206 < 200
=========== 1 failed, 7 passed, 4368 deselected, 1 xfailed in 10.41s ===========

@Dreamsorcerer
Copy link
Copy Markdown
Member

CI is failing due to flaky test (see #11992)

Well, actually idna is probably the cause that started this test failing...
kjd/idna#188

It seems that's it's unreliable enough that a more recent version managed to pass and get merged regardless, hence the flakiness we see today. Ideally we can pull the import time back down in future...

@Dreamsorcerer Dreamsorcerer added backport-3.13 Trigger automatic backporting to the 3.13 release branch by Patchback robot backport-3.14 Trigger automatic backporting to the 3.14 release branch by Patchback robot labels Feb 6, 2026
@rodrigobnogueira
Copy link
Copy Markdown
Member Author

CI is failing due to flaky test (see #11992)

Well, actually idna is probably the cause that started this test failing... kjd/idna#188

It seems that's it's unreliable enough that a more recent version managed to pass and get merged regardless, hence the flakiness we see today. Ideally we can pull the import time back down in future...

Ah, that’s revealing.

@codecov
Copy link
Copy Markdown

codecov bot commented Feb 7, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.75%. Comparing base (4bb9e6e) to head (07921b1).
⚠️ Report is 8 commits behind head on master.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #12036      +/-   ##
==========================================
- Coverage   98.76%   98.75%   -0.01%     
==========================================
  Files         127      127              
  Lines       44658    44658              
  Branches     2372     2372              
==========================================
- Hits        44105    44104       -1     
  Misses        393      393              
- Partials      160      161       +1     
Flag Coverage Δ
CI-GHA 98.61% <100.00%> (-0.01%) ⬇️
OS-Linux 98.35% <100.00%> (ø)
OS-Windows 96.70% <100.00%> (ø)
OS-macOS 97.59% <100.00%> (-0.01%) ⬇️
Py-3.10.11 97.13% <100.00%> (ø)
Py-3.10.19 97.62% <100.00%> (ø)
Py-3.11.14 97.82% <100.00%> (-0.01%) ⬇️
Py-3.11.9 97.34% <100.00%> (ø)
Py-3.12.10 97.44% <100.00%> (ø)
Py-3.12.12 97.93% <100.00%> (+<0.01%) ⬆️
Py-3.13.11 98.17% <100.00%> (-0.01%) ⬇️
Py-3.14.2 98.15% <100.00%> (-0.01%) ⬇️
Py-3.14.3t 97.23% <100.00%> (-0.01%) ⬇️
Py-pypy3.11.13-7.3.20 97.39% <100.00%> (+<0.01%) ⬆️
VM-macos 97.59% <100.00%> (-0.01%) ⬇️
VM-ubuntu 98.35% <100.00%> (ø)
VM-windows 96.70% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Dreamsorcerer Dreamsorcerer merged commit 9053e8c into aio-libs:master Feb 15, 2026
67 of 106 checks passed
@patchback
Copy link
Copy Markdown
Contributor

patchback bot commented Feb 15, 2026

Backport to 3.13: 💔 cherry-picking failed — conflicts found

❌ Failed to cleanly apply 9053e8c on top of patchback/backports/3.13/9053e8ce4a72cfc38eba9f224d4d432371c0c25b/pr-12036

Backporting merged PR #12036 into master

  1. Ensure you have a local repo clone of your fork. Unless you cloned it
    from the upstream, this would be your origin remote.
  2. Make sure you have an upstream repo added as a remote too. In these
    instructions you'll refer to it by the name upstream. If you don't
    have it, here's how you can add it:
    $ git remote add upstream https://github.com/aio-libs/aiohttp.git
  3. Ensure you have the latest copy of upstream and prepare a branch
    that will hold the backported code:
    $ git fetch upstream
    $ git checkout -b patchback/backports/3.13/9053e8ce4a72cfc38eba9f224d4d432371c0c25b/pr-12036 upstream/3.13
  4. Now, cherry-pick PR Fix test_invalid_idna for idna 3.11 compatibility #12036 contents into that branch:
    $ git cherry-pick -x 9053e8ce4a72cfc38eba9f224d4d432371c0c25b
    If it'll yell at you with something like fatal: Commit 9053e8ce4a72cfc38eba9f224d4d432371c0c25b is a merge but no -m option was given., add -m 1 as follows instead:
    $ git cherry-pick -m1 -x 9053e8ce4a72cfc38eba9f224d4d432371c0c25b
  5. At this point, you'll probably encounter some merge conflicts. You must
    resolve them in to preserve the patch from PR Fix test_invalid_idna for idna 3.11 compatibility #12036 as close to the
    original as possible.
  6. Push this branch to your fork on GitHub:
    $ git push origin patchback/backports/3.13/9053e8ce4a72cfc38eba9f224d4d432371c0c25b/pr-12036
  7. Create a PR, ensure that the CI is green. If it's not — update it so that
    the tests and any other checks pass. This is it!
    Now relax and wait for the maintainers to process your pull request
    when they have some cycles to do reviews. Don't worry — they'll tell you if
    any improvements are necessary when the time comes!

🤖 @patchback
I'm built with octomachinery and
my source is open — https://github.com/sanitizers/patchback-github-app.

@patchback
Copy link
Copy Markdown
Contributor

patchback bot commented Feb 15, 2026

Backport to 3.14: 💔 cherry-picking failed — conflicts found

❌ Failed to cleanly apply 9053e8c on top of patchback/backports/3.14/9053e8ce4a72cfc38eba9f224d4d432371c0c25b/pr-12036

Backporting merged PR #12036 into master

  1. Ensure you have a local repo clone of your fork. Unless you cloned it
    from the upstream, this would be your origin remote.
  2. Make sure you have an upstream repo added as a remote too. In these
    instructions you'll refer to it by the name upstream. If you don't
    have it, here's how you can add it:
    $ git remote add upstream https://github.com/aio-libs/aiohttp.git
  3. Ensure you have the latest copy of upstream and prepare a branch
    that will hold the backported code:
    $ git fetch upstream
    $ git checkout -b patchback/backports/3.14/9053e8ce4a72cfc38eba9f224d4d432371c0c25b/pr-12036 upstream/3.14
  4. Now, cherry-pick PR Fix test_invalid_idna for idna 3.11 compatibility #12036 contents into that branch:
    $ git cherry-pick -x 9053e8ce4a72cfc38eba9f224d4d432371c0c25b
    If it'll yell at you with something like fatal: Commit 9053e8ce4a72cfc38eba9f224d4d432371c0c25b is a merge but no -m option was given., add -m 1 as follows instead:
    $ git cherry-pick -m1 -x 9053e8ce4a72cfc38eba9f224d4d432371c0c25b
  5. At this point, you'll probably encounter some merge conflicts. You must
    resolve them in to preserve the patch from PR Fix test_invalid_idna for idna 3.11 compatibility #12036 as close to the
    original as possible.
  6. Push this branch to your fork on GitHub:
    $ git push origin patchback/backports/3.14/9053e8ce4a72cfc38eba9f224d4d432371c0c25b/pr-12036
  7. Create a PR, ensure that the CI is green. If it's not — update it so that
    the tests and any other checks pass. This is it!
    Now relax and wait for the maintainers to process your pull request
    when they have some cycles to do reviews. Don't worry — they'll tell you if
    any improvements are necessary when the time comes!

🤖 @patchback
I'm built with octomachinery and
my source is open — https://github.com/sanitizers/patchback-github-app.

@webknjaz
Copy link
Copy Markdown
Member

@rodrigobnogueira have you looked into backporting?

@rodrigobnogueira
Copy link
Copy Markdown
Member Author

sorry, I'll do it today

@rodrigobnogueira
Copy link
Copy Markdown
Member Author

done

webknjaz pushed a commit that referenced this pull request Feb 27, 2026
webknjaz pushed a commit that referenced this pull request Feb 27, 2026
wavebyrd pushed a commit to wavebyrd/aiohttp that referenced this pull request Mar 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport-3.13 Trigger automatic backporting to the 3.13 release branch by Patchback robot backport-3.14 Trigger automatic backporting to the 3.14 release branch by Patchback robot bot:chronographer:provided There is a change note present in this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test_invalid_idna fails with idna 3.11

3 participants