]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-38080: Added "getproxies" to urllib fixes in the 2to3 tool (GH-16167)
authorJosé Roberto Meza Cabrera <robertpro01@gmail.com>
Wed, 11 Mar 2020 23:51:20 +0000 (18:51 -0500)
committerGitHub <noreply@github.com>
Wed, 11 Mar 2020 23:51:20 +0000 (23:51 +0000)
Lib/lib2to3/fixes/fix_urllib.py
Lib/lib2to3/tests/test_fixers.py
Misc/NEWS.d/next/Tools-Demos/2019-09-18-13-49-56.bpo-38080.Nbl7lF.rst [new file with mode: 0644]

index 5a36049df5cb064809d6da4b3ba55061f3ed87d7..ab892bc52494c25bf5b46f92ca862965b4d99e5c 100644 (file)
@@ -13,7 +13,7 @@ MAPPING = {"urllib":  [
                 ("urllib.request",
                     ["URLopener", "FancyURLopener", "urlretrieve",
                      "_urlopener", "urlopen", "urlcleanup",
-                     "pathname2url", "url2pathname"]),
+                     "pathname2url", "url2pathname", "getproxies"]),
                 ("urllib.parse",
                     ["quote", "quote_plus", "unquote", "unquote_plus",
                      "urlencode", "splitattr", "splithost", "splitnport",
index a28524198181333e37cae56676673b35665c178c..121ebe68e5402ba29b94a2ca122eb272a6cac3e3 100644 (file)
@@ -1913,7 +1913,11 @@ def foo():
 """
         self.check(b, a)
 
+    def test_single_import(self):
+        b = "from urllib import getproxies"
+        a = "from urllib.request import getproxies"
 
+        self.check(b, a)
 
     def test_import_module_usage(self):
         for old, changes in self.modules.items():
diff --git a/Misc/NEWS.d/next/Tools-Demos/2019-09-18-13-49-56.bpo-38080.Nbl7lF.rst b/Misc/NEWS.d/next/Tools-Demos/2019-09-18-13-49-56.bpo-38080.Nbl7lF.rst
new file mode 100644 (file)
index 0000000..1b6def1
--- /dev/null
@@ -0,0 +1,2 @@
+Added support to fix ``getproxies`` in the :mod:`lib2to3.fixes.fix_urllib`
+module. Patch by José Roberto Meza Cabrera.