File tree Expand file tree Collapse file tree 4 files changed +13
-2
lines changed Expand file tree Collapse file tree 4 files changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -152,6 +152,9 @@ The :mod:`urllib.request` module defines the following functions:
152152 the path component of a URL. This does not produce a complete URL. The return
153153 value will already be quoted using the :func: `~urllib.parse.quote ` function.
154154
155+ .. versionchanged :: 3.14
156+ Windows drive letters are no longer converted to uppercase.
157+
155158 .. versionchanged :: 3.14
156159 On Windows, ``: `` characters not following a drive letter are quoted. In
157160 previous versions, :exc: `OSError ` was raised if a colon character was
@@ -164,6 +167,10 @@ The :mod:`urllib.request` module defines the following functions:
164167 path. This does not accept a complete URL. This function uses
165168 :func: `~urllib.parse.unquote ` to decode *path *.
166169
170+ .. versionchanged :: 3.14
171+ Windows drive letters are no longer converted to uppercase.
172+
173+
167174.. function :: getproxies()
168175
169176 This helper function returns a dictionary of scheme to proxy server URL
Original file line number Diff line number Diff line change @@ -35,7 +35,7 @@ def url2pathname(url):
3535 if len (comp ) != 2 or comp [0 ][- 1 ] not in string .ascii_letters :
3636 error = 'Bad URL: ' + url
3737 raise OSError (error )
38- drive = comp [0 ][- 1 ]. upper ()
38+ drive = comp [0 ][- 1 ]
3939 tail = urllib .parse .unquote (comp [1 ].replace ('/' , '\\ ' ))
4040 return drive + ':' + tail
4141
@@ -60,7 +60,7 @@ def pathname2url(p):
6060 # DOS drive specified. Add three slashes to the start, producing
6161 # an authority section with a zero-length authority, and a path
6262 # section starting with a single slash.
63- drive = f'///{ drive . upper () } '
63+ drive = f'///{ drive } '
6464
6565 drive = urllib .parse .quote (drive , safe = '/:' )
6666 tail = urllib .parse .quote (tail )
Original file line number Diff line number Diff line change @@ -1423,6 +1423,7 @@ def test_pathname2url_win(self):
14231423 self .assertEqual (fn ('\\ \\ ?\\ unc\\ server\\ share\\ dir' ), '//server/share/dir' )
14241424 self .assertEqual (fn ("C:" ), '///C:' )
14251425 self .assertEqual (fn ("C:\\ " ), '///C:/' )
1426+ self .assertEqual (fn ('c:\\ a\\ b.c' ), '///c:/a/b.c' )
14261427 self .assertEqual (fn ('C:\\ a\\ b.c' ), '///C:/a/b.c' )
14271428 self .assertEqual (fn ('C:\\ a\\ b.c\\ ' ), '///C:/a/b.c/' )
14281429 self .assertEqual (fn ('C:\\ a\\ \\ b.c' ), '///C:/a//b.c' )
@@ -1480,6 +1481,7 @@ def test_url2pathname_win(self):
14801481 self .assertEqual (fn ("///C/test/" ), '\\ C\\ test\\ ' )
14811482 self .assertEqual (fn ("////C/test/" ), '\\ \\ C\\ test\\ ' )
14821483 # DOS drive paths
1484+ self .assertEqual (fn ('c:/path/to/file' ), 'c:\\ path\\ to\\ file' )
14831485 self .assertEqual (fn ('C:/path/to/file' ), 'C:\\ path\\ to\\ file' )
14841486 self .assertEqual (fn ('C:/path/to/file/' ), 'C:\\ path\\ to\\ file\\ ' )
14851487 self .assertEqual (fn ('C:/path/to//file' ), 'C:\\ path\\ to\\ \\ file' )
Original file line number Diff line number Diff line change 1+ :func: `urllib.request.pathname2url ` and :func: `~urllib.request.url2pathname `
2+ no longer convert Windows drive letters to uppercase.
You can’t perform that action at this time.
0 commit comments