Skip to content
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

Correctly handle zero explicit_port #1413

Merged
merged 1 commit into from
Nov 12, 2024

Conversation

gmacon
Copy link
Contributor

@gmacon gmacon commented Nov 9, 2024

What do these changes do?

This changes URL.port to return the explicit port instead of the default port when the explicit port is zero (i.e. not-None but falsy).

Are there changes in behavior for the user?

The URL.port attribute is supposed to give the port part of the URL with a scheme-based fallback, but it incorrectly used the fallback value when the given value was zero. This fixes the bug, returning the given value even when it is zero.

Related issue number

Fixes #1408

Checklist

  • I think the code is well written
  • Unit tests for the changes exist
  • Documentation reflects the changes

@gmacon gmacon force-pushed the 1408-zero-port-xfail branch from 8b6aa54 to 82322dd Compare November 9, 2024 22:38
@psf-chronographer psf-chronographer bot added the bot:chronographer:provided There is a change note present in this PR label Nov 9, 2024
@gmacon gmacon force-pushed the 1408-zero-port-xfail branch from 82322dd to 8b183cb Compare November 9, 2024 22:42
Copy link

codspeed-hq bot commented Nov 9, 2024

CodSpeed Performance Report

Merging #1413 will not alter performance

Comparing gmacon:1408-zero-port-xfail (8b183cb) with master (d6a65eb)

Summary

✅ 83 untouched benchmarks

Copy link

codecov bot commented Nov 9, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.06%. Comparing base (dfc41db) to head (8b183cb).
Report is 3 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1413   +/-   ##
=======================================
  Coverage   96.06%   96.06%           
=======================================
  Files          31       31           
  Lines        5765     5772    +7     
  Branches      344      345    +1     
=======================================
+ Hits         5538     5545    +7     
  Misses        201      201           
  Partials       26       26           
Flag Coverage Δ
CI-GHA 96.06% <100.00%> (+<0.01%) ⬆️
MyPy 48.67% <50.00%> (-0.01%) ⬇️
OS-Linux 99.55% <100.00%> (+<0.01%) ⬆️
OS-Windows 99.62% <100.00%> (+<0.01%) ⬆️
OS-macOS 99.30% <100.00%> (+<0.01%) ⬆️
Py-3.10.11 99.28% <100.00%> (+<0.01%) ⬆️
Py-3.10.15 99.51% <100.00%> (+<0.01%) ⬆️
Py-3.11.10 99.51% <100.00%> (+<0.01%) ⬆️
Py-3.11.9 99.28% <100.00%> (+<0.01%) ⬆️
Py-3.12.7 99.51% <100.00%> (+<0.01%) ⬆️
Py-3.13.0 99.51% <100.00%> (+<0.01%) ⬆️
Py-3.9.13 99.23% <100.00%> (+<0.01%) ⬆️
Py-3.9.20 99.47% <100.00%> (+<0.01%) ⬆️
Py-pypy7.3.16 99.53% <100.00%> (+<0.01%) ⬆️
Py-pypy7.3.17 99.55% <100.00%> (+<0.01%) ⬆️
VM-macos-latest 99.30% <100.00%> (+<0.01%) ⬆️
VM-ubuntu-latest 99.55% <100.00%> (+<0.01%) ⬆️
VM-windows-latest 99.62% <100.00%> (+<0.01%) ⬆️
pytest 99.55% <100.00%> (+<0.01%) ⬆️

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.

Copy link
Member

@asvetlov asvetlov left a comment

Choose a reason for hiding this comment

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

Looks good, thanks.

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.

Thanks!

@webknjaz webknjaz merged commit 3fbc1f1 into aio-libs:master Nov 12, 2024
44 of 46 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.

Explicit port 0 replaced with default port
3 participants