From fcb37eb98482d6c3c97ad1ac4be51b5839e22fb6 Mon Sep 17 00:00:00 2001 From: Senthil Kumaran Date: Wed, 28 Oct 2026 12:17:25 -0700 Subject: [PATCH] gh-56689 test case to cover for windows proxy_bypass misbehaving trailing ; entries on windows. (GH-160841) gh-56689 test case to cover for windows proxy_bypass misbehaving with trailing ; entries on windows. Issue was fixed in GH-115210 Co-Authored by Claude Code. (cherry picked from commit af4468863128e6d2593335ca522ee151150a692c) Co-authored-by: Senthil Kumaran --- Lib/test/test_urllib2.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Lib/test/test_urllib2.py b/Lib/test/test_urllib2.py index 7efbc81a16096a6..3e4fec6e3e84744 100644 --- a/Lib/test/test_urllib2.py +++ b/Lib/test/test_urllib2.py @@ -1625,6 +1625,14 @@ def test_winreg_proxy_bypass(self): "expect to bypass intranet address '%s'" % host) + # empty entries (e.g. a trailing ';') must not match every host + for proxy_override in ("www.example.com;", ";", " ; ", + "www.example.com;;*.example.net"): + self.assertFalse(proxy_bypass("www.python.org", proxy_override), + "expected empty entry in %r not to bypass" + % proxy_override) + self.assertTrue(proxy_bypass("www.example.com", "www.example.com;")) + @unittest.skipUnless(sys.platform == 'darwin', "only relevant for OSX") def test_osx_proxy_bypass(self): bypass = {