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
ed1ac587
Kaydet (Commit)
ed1ac587
authored
Ara 06, 2011
tarafından
Lars Gustäbel
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Correctly detect bzip2 compressed streams with blocksizes other than 900k.
üst
9f571354
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
5 deletions
+22
-5
tarfile.py
Lib/tarfile.py
+1
-1
test_tarfile.py
Lib/test/test_tarfile.py
+18
-4
NEWS
Misc/NEWS
+3
-0
No files found.
Lib/tarfile.py
Dosyayı görüntüle @
ed1ac587
...
@@ -627,7 +627,7 @@ class _StreamProxy(object):
...
@@ -627,7 +627,7 @@ class _StreamProxy(object):
def
getcomptype
(
self
):
def
getcomptype
(
self
):
if
self
.
buf
.
startswith
(
b
"
\037\213\010
"
):
if
self
.
buf
.
startswith
(
b
"
\037\213\010
"
):
return
"gz"
return
"gz"
if
self
.
buf
.
startswith
(
b
"BZh91"
)
:
if
self
.
buf
[
0
:
3
]
==
b
"BZh"
and
self
.
buf
[
4
:
10
]
==
b
"1AY&SY"
:
return
"bz2"
return
"bz2"
return
"tar"
return
"tar"
...
...
Lib/test/test_tarfile.py
Dosyayı görüntüle @
ed1ac587
...
@@ -529,6 +529,23 @@ class DetectReadTest(unittest.TestCase):
...
@@ -529,6 +529,23 @@ class DetectReadTest(unittest.TestCase):
def
test_detect_fileobj
(
self
):
def
test_detect_fileobj
(
self
):
self
.
_test_modes
(
self
.
_testfunc_fileobj
)
self
.
_test_modes
(
self
.
_testfunc_fileobj
)
def
test_detect_stream_bz2
(
self
):
# Originally, tarfile's stream detection looked for the string
# "BZh91" at the start of the file. This is incorrect because
# the '9' represents the blocksize (900kB). If the file was
# compressed using another blocksize autodetection fails.
if
not
bz2
:
return
with
open
(
tarname
,
"rb"
)
as
fobj
:
data
=
fobj
.
read
()
# Compress with blocksize 100kB, the file starts with "BZh11".
with
bz2
.
BZ2File
(
tmpname
,
"wb"
,
compresslevel
=
1
)
as
fobj
:
fobj
.
write
(
data
)
self
.
_testfunc_file
(
tmpname
,
"r|*"
)
class
MemberReadTest
(
ReadTest
):
class
MemberReadTest
(
ReadTest
):
...
@@ -1818,11 +1835,8 @@ def test_main():
...
@@ -1818,11 +1835,8 @@ def test_main():
if
bz2
:
if
bz2
:
# Create testtar.tar.bz2 and add bz2-specific tests.
# Create testtar.tar.bz2 and add bz2-specific tests.
support
.
unlink
(
bz2name
)
support
.
unlink
(
bz2name
)
tar
=
bz2
.
BZ2File
(
bz2name
,
"wb"
)
with
bz2
.
BZ2File
(
bz2name
,
"wb"
)
as
tar
:
try
:
tar
.
write
(
data
)
tar
.
write
(
data
)
finally
:
tar
.
close
()
tests
+=
[
tests
+=
[
Bz2MiscReadTest
,
Bz2MiscReadTest
,
...
...
Misc/NEWS
Dosyayı görüntüle @
ed1ac587
...
@@ -90,6 +90,9 @@ Core and Builtins
...
@@ -90,6 +90,9 @@ Core and Builtins
Library
Library
-------
-------
- tarfile.py: Correctly detect bzip2 compressed streams with blocksizes
other than 900k.
- Issue #13439: Fix many errors in turtle docstrings.
- Issue #13439: Fix many errors in turtle docstrings.
- Issue #13487: Make inspect.getmodule robust against changes done to
- Issue #13487: Make inspect.getmodule robust against changes done to
...
...
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