Skip to content

Disable TLS in TLS warning for uvloop #10726

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Apr 21, 2025
Merged

Conversation

lezgomatt
Copy link
Contributor

@lezgomatt lezgomatt commented Apr 16, 2025

What do these changes do?

  • Disables the TLS in TLS warning (when using HTTPS proxies) for uvloop and newer Python versions (3.11 and up)
    • Asyncio support was added in 3.11, see: bpo-44011
    • For older versions of Python, we still fallback to the original check

Are there changes in behavior for the user?

Not really. Users using uvloop or newer versions of Python will no longer see a warning when sending an HTTPS request through an HTTPS proxy.

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

No.

Related issue number

Fixes #7686

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

@lezgomatt lezgomatt requested a review from asvetlov as a code owner April 16, 2025 14:41
Copy link

codspeed-hq bot commented Apr 16, 2025

CodSpeed Performance Report

Merging #10726 will not alter performance

Comparing lezgomatt:master (15c59bf) with master (b97d6bf)

Summary

✅ 58 untouched benchmarks

@lezgomatt
Copy link
Contributor Author

Test failure is because the underlying transport is a mock and so the old check getattr(underlying_transport, "_start_tls_compatible", False) would return another mock, which would be truthy, but the new check only checks the version so 3.10 and below would always fail.

I'll add the old check again for older versions of Python, not just to pass the test, but also because some users may have patched that attribute as well.

@lezgomatt lezgomatt requested a review from webknjaz as a code owner April 17, 2025 00:59
@psf-chronographer psf-chronographer bot added the bot:chronographer:provided There is a change note present in this PR label Apr 17, 2025
Copy link

codecov bot commented Apr 17, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.72%. Comparing base (d912123) to head (15c59bf).
Report is 50 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master   #10726   +/-   ##
=======================================
  Coverage   98.72%   98.72%           
=======================================
  Files         125      125           
  Lines       37722    37819   +97     
  Branches     2082     2086    +4     
=======================================
+ Hits        37240    37336   +96     
- Misses        334      335    +1     
  Partials      148      148           
Flag Coverage Δ
CI-GHA 98.60% <100.00%> (+<0.01%) ⬆️
OS-Linux 98.27% <100.00%> (+<0.01%) ⬆️
OS-Windows 96.19% <44.44%> (-0.04%) ⬇️
OS-macOS 97.39% <92.59%> (+<0.01%) ⬆️
Py-3.10.11 97.30% <100.00%> (+<0.01%) ⬆️
Py-3.10.16 ?
Py-3.10.17 97.84% <92.59%> (-0.01%) ⬇️
Py-3.11.11 ?
Py-3.11.12 97.91% <92.59%> (-0.02%) ⬇️
Py-3.11.9 97.39% <100.00%> (+<0.01%) ⬆️
Py-3.12.10 98.03% <92.59%> (-0.01%) ⬇️
Py-3.12.9 97.50% <100.00%> (-0.87%) ⬇️
Py-3.13.2 97.49% <100.00%> (-0.88%) ⬇️
Py-3.13.3 98.03% <92.59%> (-0.01%) ⬇️
Py-3.9.13 97.17% <100.00%> (+0.01%) ⬆️
Py-3.9.21 ?
Py-3.9.22 97.70% <92.59%> (+<0.01%) ⬆️
Py-pypy7.3.16 93.05% <44.44%> (-2.41%) ⬇️
VM-macos 97.39% <92.59%> (+<0.01%) ⬆️
VM-ubuntu 98.27% <100.00%> (+<0.01%) ⬆️
VM-windows 96.19% <44.44%> (-0.04%) ⬇️

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.

@lezgomatt lezgomatt mentioned this pull request Apr 17, 2025
1 task
@Dreamsorcerer Dreamsorcerer added backport-3.11 Trigger automatic backporting to the 3.11 release branch by Patchback robot backport-3.12 Trigger automatic backporting to the 3.12 release branch by Patchback robot labels Apr 17, 2025
@bdraco bdraco merged commit feff48d into aio-libs:master Apr 21, 2025
40 checks passed
Copy link
Contributor

patchback bot commented Apr 21, 2025

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

❌ Failed to cleanly apply feff48d on top of patchback/backports/3.11/feff48d43ae297254f8d3502839ddaeaacb8dad4/pr-10726

Backporting merged PR #10726 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.11/feff48d43ae297254f8d3502839ddaeaacb8dad4/pr-10726 upstream/3.11
  4. Now, cherry-pick PR Disable TLS in TLS warning for uvloop #10726 contents into that branch:
    $ git cherry-pick -x feff48d43ae297254f8d3502839ddaeaacb8dad4
    If it'll yell at you with something like fatal: Commit feff48d43ae297254f8d3502839ddaeaacb8dad4 is a merge but no -m option was given., add -m 1 as follows instead:
    $ git cherry-pick -m1 -x feff48d43ae297254f8d3502839ddaeaacb8dad4
  5. At this point, you'll probably encounter some merge conflicts. You must
    resolve them in to preserve the patch from PR Disable TLS in TLS warning for uvloop #10726 as close to the
    original as possible.
  6. Push this branch to your fork on GitHub:
    $ git push origin patchback/backports/3.11/feff48d43ae297254f8d3502839ddaeaacb8dad4/pr-10726
  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.

Copy link
Contributor

patchback bot commented Apr 21, 2025

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

❌ Failed to cleanly apply feff48d on top of patchback/backports/3.12/feff48d43ae297254f8d3502839ddaeaacb8dad4/pr-10726

Backporting merged PR #10726 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.12/feff48d43ae297254f8d3502839ddaeaacb8dad4/pr-10726 upstream/3.12
  4. Now, cherry-pick PR Disable TLS in TLS warning for uvloop #10726 contents into that branch:
    $ git cherry-pick -x feff48d43ae297254f8d3502839ddaeaacb8dad4
    If it'll yell at you with something like fatal: Commit feff48d43ae297254f8d3502839ddaeaacb8dad4 is a merge but no -m option was given., add -m 1 as follows instead:
    $ git cherry-pick -m1 -x feff48d43ae297254f8d3502839ddaeaacb8dad4
  5. At this point, you'll probably encounter some merge conflicts. You must
    resolve them in to preserve the patch from PR Disable TLS in TLS warning for uvloop #10726 as close to the
    original as possible.
  6. Push this branch to your fork on GitHub:
    $ git push origin patchback/backports/3.12/feff48d43ae297254f8d3502839ddaeaacb8dad4/pr-10726
  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.

bdraco pushed a commit that referenced this pull request Apr 21, 2025
bdraco pushed a commit that referenced this pull request Apr 21, 2025
bdraco added a commit that referenced this pull request Apr 21, 2025
bdraco added a commit that referenced this pull request Apr 21, 2025
Copy link
Member

@webknjaz webknjaz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A note for the future: in such cases, it should be good to use pytest.importorskip().

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-3.11 Trigger automatic backporting to the 3.11 release branch by Patchback robot backport-3.12 Trigger automatic backporting to the 3.12 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.

incorrect operation with uvloop
4 participants