Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
99e97f92
Commit
99e97f92
authored
Apr 14, 2011
by
Senthil Kumaran
Browse files
Options
Browse Files
Download
Plain Diff
merge from 3.2.
Fix closes Issue1147.
parents
c470a0c7
56f1e2d8
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
1 deletion
+25
-1
Lib/nturl2path.py
Lib/nturl2path.py
+4
-1
Lib/test/test_urllib.py
Lib/test/test_urllib.py
+18
-0
Misc/NEWS
Misc/NEWS
+3
-0
No files found.
Lib/nturl2path.py
View file @
99e97f92
...
@@ -27,9 +27,12 @@ def url2pathname(url):
...
@@ -27,9 +27,12 @@ def url2pathname(url):
drive
=
comp
[
0
][
-
1
].
upper
()
drive
=
comp
[
0
][
-
1
].
upper
()
components
=
comp
[
1
].
split
(
'/'
)
components
=
comp
[
1
].
split
(
'/'
)
path
=
drive
+
':'
path
=
drive
+
':'
for
comp
in
components
:
for
comp
in
components
:
if
comp
:
if
comp
:
path
=
path
+
'
\
\
'
+
urllib
.
parse
.
unquote
(
comp
)
path
=
path
+
'
\
\
'
+
urllib
.
parse
.
unquote
(
comp
)
# Issue #11474 - handing url such as |c/|
if
path
.
endswith
(
':'
)
and
url
.
endswith
(
'/'
):
path
+=
'
\
\
'
return
path
return
path
def
pathname2url
(
p
):
def
pathname2url
(
p
):
...
...
Lib/test/test_urllib.py
View file @
99e97f92
...
@@ -9,6 +9,7 @@ import io
...
@@ -9,6 +9,7 @@ import io
import
unittest
import
unittest
from
test
import
support
from
test
import
support
import
os
import
os
import
sys
import
tempfile
import
tempfile
def
hexescape
(
char
):
def
hexescape
(
char
):
...
@@ -1021,6 +1022,23 @@ class Pathname_Tests(unittest.TestCase):
...
@@ -1021,6 +1022,23 @@ class Pathname_Tests(unittest.TestCase):
"url2pathname() failed; %s != %s"
%
"url2pathname() failed; %s != %s"
%
(
expect
,
result
))
(
expect
,
result
))
@
unittest
.
skipUnless
(
sys
.
platform
==
'win32'
,
'test specific to the urllib.url2path function.'
)
def
test_ntpath
(
self
):
given
=
(
'/C:/'
,
'///C:/'
,
'/C|//'
)
expect
=
'C:
\
\
'
for
url
in
given
:
result
=
urllib
.
request
.
url2pathname
(
url
)
self
.
assertEqual
(
expect
,
result
,
'urllib.request..url2pathname() failed; %s != %s'
%
(
expect
,
result
))
given
=
'///C|/path'
expect
=
'C:
\
\
path'
result
=
urllib
.
request
.
url2pathname
(
given
)
self
.
assertEqual
(
expect
,
result
,
'urllib.request.url2pathname() failed; %s != %s'
%
(
expect
,
result
))
class
Utility_Tests
(
unittest
.
TestCase
):
class
Utility_Tests
(
unittest
.
TestCase
):
"""Testcase to test the various utility functions in the urllib."""
"""Testcase to test the various utility functions in the urllib."""
...
...
Misc/NEWS
View file @
99e97f92
...
@@ -103,6 +103,9 @@ Core and Builtins
...
@@ -103,6 +103,9 @@ Core and Builtins
Library
Library
-------
-------
- Issue #11474: Fix the bug with url2pathname() handling of '
/
C
|/
' on Windows.
Patch by Santoso Wijaya.
- Issue #11684: complete email.parser bytes API by adding BytesHeaderParser.
- Issue #11684: complete email.parser bytes API by adding BytesHeaderParser.
- The bz2 module now handles 4GiB+ input buffers correctly.
- The bz2 module now handles 4GiB+ input buffers correctly.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment