This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author corona10
Recipients corona10
Date 2019-02-08.08:14:43
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1549613683.87.0.509050815243.issue35939@roundup.psfhosted.org>
In-reply-to
Content
Since urllib.parse.splittype is deprecated on 3.8.
In the future urllib.parse._splittype also should be removed.

I found that mimetypes.guess_type uses urllib.parse._splittype and
it can be replaced and it also looks like solve the issue mentioned on https://github.com/python/cpython/blame/e42b705188271da108de42b55d9344642170aa2b/Lib/test/test_urllib2.py#L749

And I checked that all unit tests are passed when

--- a/Lib/mimetypes.py
+++ b/Lib/mimetypes.py
@@ -114,7 +114,8 @@ class MimeTypes:
         but non-standard types.
         """
         url = os.fspath(url)
-        scheme, url = urllib.parse._splittype(url)
+        p = urllib.parse.urlparse(url)
+        scheme, url = p.scheme, p.path
         if scheme == 'data':
             # syntax of data URLs:
             # dataurl   := "data:" [ mediatype ] [ ";base64" ] "," data
diff --git a/Lib/test/test_urllib2.py b/Lib/test/test_urllib2.py
index 876fcd4199..0677390c2b 100644
--- a/Lib/test/test_urllib2.py
+++ b/Lib/test/test_urllib2.py
@@ -746,7 +746,7 @@ class HandlerTests(unittest.TestCase):
              ["foo", "bar"], "", None),
             ("ftp://localhost/baz.gif;type=a",
              "localhost", ftplib.FTP_PORT, "", "", "A",
-             [], "baz.gif", None),  # XXX really this should guess image/gif
+             [], "baz.gif", "image/gif"),
             ]:
             req = Request(url)
             req.timeout = None

I'd like to work on this issue if this proposal is accepted!
Always thanks
History
Date User Action Args
2019-02-08 08:14:47corona10setrecipients: + corona10
2019-02-08 08:14:43corona10setmessageid: <1549613683.87.0.509050815243.issue35939@roundup.psfhosted.org>
2019-02-08 08:14:43corona10linkissue35939 messages
2019-02-08 08:14:43corona10create