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
7a278da4
Kaydet (Commit)
7a278da4
authored
Ock 18, 2014
tarafından
Serhiy Storchaka
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #20243: TarFile no longer raise ReadError when opened in write mode.
üst
cdf1ebd8
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
2 deletions
+24
-2
tarfile.py
Lib/tarfile.py
+6
-2
test_tarfile.py
Lib/test/test_tarfile.py
+16
-0
NEWS
Misc/NEWS
+2
-0
No files found.
Lib/tarfile.py
Dosyayı görüntüle @
7a278da4
...
...
@@ -1726,7 +1726,9 @@ class TarFile(object):
gzip
.
GzipFile
(
name
,
mode
,
compresslevel
,
fileobj
),
**
kwargs
)
except
IOError
:
raise
ReadError
(
"not a gzip file"
)
if
mode
==
'r'
:
raise
ReadError
(
"not a gzip file"
)
raise
t
.
_extfileobj
=
False
return
t
...
...
@@ -1751,7 +1753,9 @@ class TarFile(object):
try
:
t
=
cls
.
taropen
(
name
,
mode
,
fileobj
,
**
kwargs
)
except
(
IOError
,
EOFError
):
raise
ReadError
(
"not a bzip2 file"
)
if
mode
==
'r'
:
raise
ReadError
(
"not a bzip2 file"
)
raise
t
.
_extfileobj
=
False
return
t
...
...
Lib/test/test_tarfile.py
Dosyayı görüntüle @
7a278da4
...
...
@@ -979,6 +979,22 @@ class WriteTest(WriteTestBase):
os
.
unlink
(
temparchive
)
shutil
.
rmtree
(
tempdir
)
def
test_open_nonwritable_fileobj
(
self
):
for
exctype
in
IOError
,
EOFError
,
RuntimeError
:
class
BadFile
(
StringIO
.
StringIO
):
first
=
True
def
write
(
self
,
data
):
if
self
.
first
:
self
.
first
=
False
raise
exctype
f
=
BadFile
()
with
self
.
assertRaises
(
exctype
):
tar
=
tarfile
.
open
(
tmpname
,
self
.
mode
,
fileobj
=
f
,
format
=
tarfile
.
PAX_FORMAT
,
pax_headers
=
{
'non'
:
'empty'
})
self
.
assertFalse
(
f
.
closed
)
class
StreamWriteTest
(
WriteTestBase
):
mode
=
"w|"
...
...
Misc/NEWS
Dosyayı görüntüle @
7a278da4
...
...
@@ -35,6 +35,8 @@ Core and Builtins
Library
-------
- Issue #20243: TarFile no longer raise ReadError when opened in write mode.
- Issue #20245: The open functions in the tarfile module now correctly handle
empty mode.
...
...
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