Skip to content

Commit 276a84a

Browse files
authored
bpo-38080: Added "getproxies" to urllib fixes in the 2to3 tool (GH-16167)
1 parent 64838ce commit 276a84a

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

Lib/lib2to3/fixes/fix_urllib.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
("urllib.request",
1414
["URLopener", "FancyURLopener", "urlretrieve",
1515
"_urlopener", "urlopen", "urlcleanup",
16-
"pathname2url", "url2pathname"]),
16+
"pathname2url", "url2pathname", "getproxies"]),
1717
("urllib.parse",
1818
["quote", "quote_plus", "unquote", "unquote_plus",
1919
"urlencode", "splitattr", "splithost", "splitnport",

Lib/lib2to3/tests/test_fixers.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1913,7 +1913,11 @@ def foo():
19131913
"""
19141914
self.check(b, a)
19151915

1916+
def test_single_import(self):
1917+
b = "from urllib import getproxies"
1918+
a = "from urllib.request import getproxies"
19161919

1920+
self.check(b, a)
19171921

19181922
def test_import_module_usage(self):
19191923
for old, changes in self.modules.items():
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Added support to fix ``getproxies`` in the :mod:`lib2to3.fixes.fix_urllib`
2+
module. Patch by José Roberto Meza Cabrera.

0 commit comments

Comments
 (0)