Skip to content

Conversation

PrinceNaroliya
Copy link
Contributor

@PrinceNaroliya PrinceNaroliya commented Aug 27, 2025

Problem:

  • When ProxyOverride registry value ends with a semicolon, empty string entry caused all hosts to bypass proxy incorrectly.

Fix:

  • In _proxy_bypass_winreg_override, strip empty entries from ProxyOverride.
  • Now proxy_bypass behaves correctly on Windows when registry value ends with ';'.

Test:

  • Added unit test ProxyBypassRegistryTests in test_urllib_proxy_bypass.py
  • Test verifies:
    • Host that should NOT bypass proxy (notmatching.com) returns False
    • Hosts that SHOULD bypass proxy (localhost and sub.example.com) return True

All tests pass locally: python -m test test_urllib -v

- _proxy_bypass_winreg_override now strips empty values from ProxyOverride
- Added unit test ProxyBypassRegistryTests to check trailing semicolon behavior
@PrinceNaroliya
Copy link
Contributor Author

PrinceNaroliya commented Aug 27, 2025

Hi, I’ve implemented the fix for #76646 (_proxy_bypass_winreg_override trailing semicolon issue) and added the corresponding unit test in test_urllib.py.

  • Local tests pass successfully ✅

  • NEWS entry is created at: Misc/NEWS.d/next/32465.proxy_bypass_trailing_semicolon.rst

  • Folder name and path have been double-checked, and line endings are LF

However, the CI keeps failing with bedevere/news — News entry not in an appropriate directory even though the file is correctly placed.

Could you please guide me on what I might be missing or if there’s a way to get the NEWS check to pass? Any help would be greatly appreciated!

Copy link
Member

@AA-Turner AA-Turner left a comment

Choose a reason for hiding this comment

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

Review PEP 8, the style guide for the standard language. Notably, we use underscores to separate words in variable names, which are themselves lowercase.

You may also find the Python Developer's Guide instructive.

A

@@ -1996,7 +1996,7 @@ def ip2num(ipAddr):


# Same as _proxy_bypass_macosx_sysconf, testable on all platforms
def _proxy_bypass_winreg_override(host, override):
def _proxy_bypass_winreg_override(host, proxyOverride):
Copy link
Member

Choose a reason for hiding this comment

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

Why?

Comment on lines 2011 to 2013
proxy_override = override.split(';')
for test in proxy_override:
test = test.strip()
Copy link
Member

Choose a reason for hiding this comment

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

This code is clearer. If the fix is to skip empty entries, just add ``if not test: continue`.

@bedevere-app
Copy link

bedevere-app bot commented Aug 27, 2025

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

@AA-Turner AA-Turner changed the title bpo-32465: Fix proxy_bypass_registry trailing semicolon on Windows gh-76646: Fix proxy_bypass_registry trailing semicolon on Windows Aug 27, 2025
@AA-Turner
Copy link
Member

However, the CI keeps failing with bedevere/news — News entry not in an appropriate directory even though the file is correctly placed.

You must use the blurb tool. I advise a close reading of the devguide.

@PrinceNaroliya
Copy link
Contributor Author

Thank you for the review and helpful feedback.
I have made the requested changes (PEP 8 naming and NEWS entry via blurb).
Please review again when convenient.

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

Successfully merging this pull request may close these issues.

2 participants