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
57fffd6f
Kaydet (Commit)
57fffd6f
authored
Şub 15, 2015
tarafından
Antoine Pitrou
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #23146: Fix mishandling of absolute Windows paths with forward slashes in pathlib.
Detected and fixed by Serhiy.
üst
0aa74e10
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
16 deletions
+27
-16
pathlib.py
Lib/pathlib.py
+4
-0
test_pathlib.py
Lib/test/test_pathlib.py
+20
-16
NEWS
Misc/NEWS
+3
-0
No files found.
Lib/pathlib.py
Dosyayı görüntüle @
57fffd6f
...
@@ -73,6 +73,10 @@ class _Flavour(object):
...
@@ -73,6 +73,10 @@ class _Flavour(object):
# parts. This makes the result of parsing e.g.
# parts. This makes the result of parsing e.g.
# ("C:", "/", "a") reasonably intuitive.
# ("C:", "/", "a") reasonably intuitive.
for
part
in
it
:
for
part
in
it
:
if
not
part
:
continue
if
altsep
:
part
=
part
.
replace
(
altsep
,
sep
)
drv
=
self
.
splitroot
(
part
)[
0
]
drv
=
self
.
splitroot
(
part
)[
0
]
if
drv
:
if
drv
:
break
break
...
...
Lib/test/test_pathlib.py
Dosyayı görüntüle @
57fffd6f
...
@@ -105,31 +105,35 @@ class NTFlavourTest(_BaseFlavourTest, unittest.TestCase):
...
@@ -105,31 +105,35 @@ class NTFlavourTest(_BaseFlavourTest, unittest.TestCase):
check
=
self
.
_check_parse_parts
check
=
self
.
_check_parse_parts
# First part is anchored
# First part is anchored
check
([
'c:'
],
(
'c:'
,
''
,
[
'c:'
]))
check
([
'c:'
],
(
'c:'
,
''
,
[
'c:'
]))
check
([
'c:
\\
'
],
(
'c:'
,
'
\\
'
,
[
'c:
\\
'
]))
check
([
'c:
/'
],
(
'c:'
,
'
\\
'
,
[
'c:
\\
'
]))
check
([
'
\\
'
],
(
''
,
'
\\
'
,
[
'
\\
'
]))
check
([
'
/'
],
(
''
,
'
\\
'
,
[
'
\\
'
]))
check
([
'c:a'
],
(
'c:'
,
''
,
[
'c:'
,
'a'
]))
check
([
'c:a'
],
(
'c:'
,
''
,
[
'c:'
,
'a'
]))
check
([
'c:
\\
a'
],
(
'c:'
,
'
\\
'
,
[
'c:
\\
'
,
'a'
]))
check
([
'c:
/a'
],
(
'c:'
,
'
\\
'
,
[
'c:
\\
'
,
'a'
]))
check
([
'
\\
a'
],
(
''
,
'
\\
'
,
[
'
\\
'
,
'a'
]))
check
([
'
/a'
],
(
''
,
'
\\
'
,
[
'
\\
'
,
'a'
]))
# UNC paths
# UNC paths
check
([
'
\\\\
a
\\
b'
],
(
'
\\\\
a
\\
b'
,
'
\\
'
,
[
'
\\\\
a
\\
b
\\
'
]))
check
([
'
//a/b'
],
(
'
\\\\
a
\\
b'
,
'
\\
'
,
[
'
\\\\
a
\\
b
\\
'
]))
check
([
'
\\\\
a
\\
b
\\
'
],
(
'
\\\\
a
\\
b'
,
'
\\
'
,
[
'
\\\\
a
\\
b
\\
'
]))
check
([
'
//a/b/'
],
(
'
\\\\
a
\\
b'
,
'
\\
'
,
[
'
\\\\
a
\\
b
\\
'
]))
check
([
'
\\\\
a
\\
b
\\
c'
],
(
'
\\\\
a
\\
b'
,
'
\\
'
,
[
'
\\\\
a
\\
b
\\
'
,
'c'
]))
check
([
'
//a/b/c'
],
(
'
\\\\
a
\\
b'
,
'
\\
'
,
[
'
\\\\
a
\\
b
\\
'
,
'c'
]))
# Second part is anchored, so that the first part is ignored
# Second part is anchored, so that the first part is ignored
check
([
'a'
,
'Z:b'
,
'c'
],
(
'Z:'
,
''
,
[
'Z:'
,
'b'
,
'c'
]))
check
([
'a'
,
'Z:b'
,
'c'
],
(
'Z:'
,
''
,
[
'Z:'
,
'b'
,
'c'
]))
check
([
'a'
,
'Z:
\\
b'
,
'c'
],
(
'Z:'
,
'
\\
'
,
[
'Z:
\\
'
,
'b'
,
'c'
]))
check
([
'a'
,
'Z:/b'
,
'c'
],
(
'Z:'
,
'
\\
'
,
[
'Z:
\\
'
,
'b'
,
'c'
]))
check
([
'a'
,
'
\\
b'
,
'c'
],
(
''
,
'
\\
'
,
[
'
\\
'
,
'b'
,
'c'
]))
# UNC paths
# UNC paths
check
([
'a'
,
'
\\\\
b
\\
c'
,
'd'
],
(
'
\\\\
b
\\
c'
,
'
\\
'
,
[
'
\\\\
b
\\
c
\\
'
,
'd'
]))
check
([
'a'
,
'
//b/c'
,
'd'
],
(
'
\\\\
b
\\
c'
,
'
\\
'
,
[
'
\\\\
b
\\
c
\\
'
,
'd'
]))
# Collapsing and stripping excess slashes
# Collapsing and stripping excess slashes
check
([
'a'
,
'Z:
\\\\
b
\\\\
c
\\
'
,
'd
\\
'
],
(
'Z:'
,
'
\\
'
,
[
'Z:
\\
'
,
'b'
,
'c'
,
'd'
]))
check
([
'a'
,
'Z:
//b//c/'
,
'd/
'
],
(
'Z:'
,
'
\\
'
,
[
'Z:
\\
'
,
'b'
,
'c'
,
'd'
]))
# UNC paths
# UNC paths
check
([
'a'
,
'
\\\\
b
\\
c
\\\\
'
,
'd'
],
(
'
\\\\
b
\\
c'
,
'
\\
'
,
[
'
\\\\
b
\\
c
\\
'
,
'd'
]))
check
([
'a'
,
'
//b/c//'
,
'd'
],
(
'
\\\\
b
\\
c'
,
'
\\
'
,
[
'
\\\\
b
\\
c
\\
'
,
'd'
]))
# Extended paths
# Extended paths
check
([
'
\\\\
?
\\
c:
\\
'
],
(
'
\\\\
?
\\
c:'
,
'
\\
'
,
[
'
\\\\
?
\\
c:
\\
'
]))
check
([
'//?/c:/'
],
(
'
\\\\
?
\\
c:'
,
'
\\
'
,
[
'
\\\\
?
\\
c:
\\
'
]))
check
([
'
\\\\
?
\\
c:
\\
a'
],
(
'
\\\\
?
\\
c:'
,
'
\\
'
,
[
'
\\\\
?
\\
c:
\\
'
,
'a'
]))
check
([
'//?/c:/a'
],
(
'
\\\\
?
\\
c:'
,
'
\\
'
,
[
'
\\\\
?
\\
c:
\\
'
,
'a'
]))
check
([
'//?/c:/a'
,
'/b'
],
(
'
\\\\
?
\\
c:'
,
'
\\
'
,
[
'
\\\\
?
\\
c:
\\
'
,
'b'
]))
# Extended UNC paths (format is "\\?\UNC\server\share")
# Extended UNC paths (format is "\\?\UNC\server\share")
check
([
'
\\\\
?
\\
UNC
\\
b
\\
c'
],
(
'
\\\\
?
\\
UNC
\\
b
\\
c'
,
'
\\
'
,
[
'
\\\\
?
\\
UNC
\\
b
\\
c
\\
'
]))
check
([
'//?/UNC/b/c'
],
(
'
\\\\
?
\\
UNC
\\
b
\\
c'
,
'
\\
'
,
[
'
\\\\
?
\\
UNC
\\
b
\\
c
\\
'
]))
check
([
'
\\\\
?
\\
UNC
\\
b
\\
c
\\
d'
],
(
'
\\\\
?
\\
UNC
\\
b
\\
c'
,
'
\\
'
,
[
'
\\\\
?
\\
UNC
\\
b
\\
c
\\
'
,
'd'
]))
check
([
'//?/UNC/b/c/d'
],
(
'
\\\\
?
\\
UNC
\\
b
\\
c'
,
'
\\
'
,
[
'
\\\\
?
\\
UNC
\\
b
\\
c
\\
'
,
'd'
]))
# Second part has a root but not drive
check
([
'a'
,
'/b'
,
'c'
],
(
''
,
'
\\
'
,
[
'
\\
'
,
'b'
,
'c'
]))
check
([
'Z:/a'
,
'/b'
,
'c'
],
(
'Z:'
,
'
\\
'
,
[
'Z:
\\
'
,
'b'
,
'c'
]))
check
([
'//?/Z:/a'
,
'/b'
,
'c'
],
(
'
\\\\
?
\\
Z:'
,
'
\\
'
,
[
'
\\\\
?
\\
Z:
\\
'
,
'b'
,
'c'
]))
def
test_splitroot
(
self
):
def
test_splitroot
(
self
):
f
=
self
.
flavour
.
splitroot
f
=
self
.
flavour
.
splitroot
...
...
Misc/NEWS
Dosyayı görüntüle @
57fffd6f
...
@@ -13,6 +13,9 @@ Core and Builtins
...
@@ -13,6 +13,9 @@ Core and Builtins
Library
Library
-------
-------
- Issue #23146: Fix mishandling of absolute Windows paths with forward
slashes in pathlib.
- Issue #23421: Fixed compression in tarfile CLI. Patch by wdv4758h.
- Issue #23421: Fixed compression in tarfile CLI. Patch by wdv4758h.
- Issue #23361: Fix possible overflow in Windows subprocess creation code.
- Issue #23361: Fix possible overflow in Windows subprocess creation code.
...
...
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