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
4774946c
Kaydet (Commit)
4774946c
authored
Tem 15, 2012
tarafından
Hynek Schlawack
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
#15180: Clarify posixpath.join() error message when mixing str & bytes
üst
a3d1cac4
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
8 deletions
+24
-8
posixpath.py
Lib/posixpath.py
+13
-6
test_posixpath.py
Lib/test/test_posixpath.py
+9
-2
NEWS
Misc/NEWS
+2
-0
No files found.
Lib/posixpath.py
Dosyayı görüntüle @
4774946c
...
...
@@ -74,13 +74,20 @@ def join(a, *p):
will be discarded."""
sep
=
_get_sep
(
a
)
path
=
a
for
b
in
p
:
if
b
.
startswith
(
sep
):
path
=
b
elif
not
path
or
path
.
endswith
(
sep
):
path
+=
b
try
:
for
b
in
p
:
if
b
.
startswith
(
sep
):
path
=
b
elif
not
path
or
path
.
endswith
(
sep
):
path
+=
b
else
:
path
+=
sep
+
b
except
TypeError
:
strs
=
[
isinstance
(
s
,
str
)
for
s
in
(
a
,
)
+
p
]
if
any
(
strs
)
and
not
all
(
strs
):
raise
TypeError
(
"Can't mix strings and bytes in path components."
)
else
:
path
+=
sep
+
b
raise
return
path
...
...
Lib/test/test_posixpath.py
Dosyayı görüntüle @
4774946c
...
...
@@ -56,8 +56,15 @@ class PosixPathTest(unittest.TestCase):
self
.
assertEqual
(
posixpath
.
join
(
b
"/foo/"
,
b
"bar/"
,
b
"baz/"
),
b
"/foo/bar/baz/"
)
self
.
assertRaises
(
TypeError
,
posixpath
.
join
,
b
"bytes"
,
"str"
)
self
.
assertRaises
(
TypeError
,
posixpath
.
join
,
"str"
,
b
"bytes"
)
with
self
.
assertRaises
(
TypeError
)
as
e
:
posixpath
.
join
(
b
'bytes'
,
'str'
)
self
.
assertIn
(
"Can't mix strings and bytes"
,
e
.
args
[
0
])
with
self
.
assertRaises
(
TypeError
)
as
e
:
posixpath
.
join
(
'str'
,
b
'bytes'
)
self
.
assertIn
(
"Can't mix strings and bytes"
,
e
.
args
[
0
])
with
self
.
assertRaises
(
TypeError
)
as
e
:
posixpath
.
join
(
'str'
,
bytearray
(
b
'bytes'
))
self
.
assertIn
(
"Can't mix strings and bytes"
,
e
.
args
[
0
])
def
test_split
(
self
):
self
.
assertEqual
(
posixpath
.
split
(
"/foo/bar"
),
(
"/foo"
,
"bar"
))
...
...
Misc/NEWS
Dosyayı görüntüle @
4774946c
...
...
@@ -87,6 +87,8 @@ Core and Builtins
Library
-------
- Issue #15180: Clarify posixpath.join() error message when mixing str & bytes
- Issue #15230: runpy.run_path now correctly sets __package__ as described
in the documentation
...
...
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