Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
a99b7619
Kaydet (Commit)
a99b7619
authored
Nis 14, 2011
tarafından
Senthil Kumaran
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fix Issue11474 - url2pathname() handling of '/C|/' on Windows
üst
7f9d2ead
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
2 deletions
+26
-2
nturl2path.py
Lib/nturl2path.py
+5
-2
test_urllib.py
Lib/test/test_urllib.py
+18
-0
NEWS
Misc/NEWS
+3
-0
No files found.
Lib/nturl2path.py
Dosyayı görüntüle @
a99b7619
...
...
@@ -25,11 +25,14 @@ def url2pathname(url):
error
=
'Bad URL: '
+
url
raise
IOError
,
error
drive
=
comp
[
0
][
-
1
]
.
upper
()
components
=
comp
[
1
]
.
split
(
'/'
)
path
=
drive
+
':'
for
comp
in
components
:
components
=
comp
[
1
]
.
split
(
'/'
)
for
comp
in
components
:
if
comp
:
path
=
path
+
'
\\
'
+
urllib
.
unquote
(
comp
)
# Issue #11474: url like '/C|/' should convert into 'C:\\'
if
path
.
endswith
(
':'
)
and
url
.
endswith
(
'/'
):
path
+=
'
\\
'
return
path
def
pathname2url
(
p
):
...
...
Lib/test/test_urllib.py
Dosyayı görüntüle @
a99b7619
...
...
@@ -5,6 +5,7 @@ import httplib
import
unittest
from
test
import
test_support
import
os
import
sys
import
mimetools
import
tempfile
import
StringIO
...
...
@@ -630,6 +631,23 @@ class Pathname_Tests(unittest.TestCase):
"url2pathname() failed;
%
s !=
%
s"
%
(
expect
,
result
))
@unittest.skipUnless
(
sys
.
platform
==
'win32'
,
'test specific to the nturl2path library'
)
def
test_ntpath
(
self
):
given
=
(
'/C:/'
,
'///C:/'
,
'/C|//'
)
expect
=
'C:
\\
'
for
url
in
given
:
result
=
urllib
.
url2pathname
(
url
)
self
.
assertEqual
(
expect
,
result
,
'nturl2path.url2pathname() failed;
%
s !=
%
s'
%
(
expect
,
result
))
given
=
'///C|/path'
expect
=
'C:
\\
path'
result
=
urllib
.
url2pathname
(
given
)
self
.
assertEqual
(
expect
,
result
,
'nturl2path.url2pathname() failed;
%
s !=
%
s'
%
(
expect
,
result
))
class
Utility_Tests
(
unittest
.
TestCase
):
"""Testcase to test the various utility functions in the urllib."""
...
...
Misc/NEWS
Dosyayı görüntüle @
a99b7619
...
...
@@ -51,6 +51,9 @@ Core and Builtins
Library
-------
- Issue #11474: Fix the bug with url2pathname() handling of '
/
C
|/
' on Windows.
Patch by Santoso Wijaya.
- Issue #9233: Fix json.loads('
{}
') to return a dict (instead of a list), when
_json is not available.
...
...
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