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
371432b9
Kaydet (Commit)
371432b9
authored
Nis 08, 2013
tarafından
Serhiy Storchaka
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Close #17666: Fix reading gzip files with an extra field.
üst
6cb4343d
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
1 deletion
+11
-1
gzip.py
Lib/gzip.py
+2
-1
test_gzip.py
Lib/test/test_gzip.py
+7
-0
NEWS
Misc/NEWS
+2
-0
No files found.
Lib/gzip.py
Dosyayı görüntüle @
371432b9
...
...
@@ -202,7 +202,8 @@ class GzipFile(io.BufferedIOBase):
if
flag
&
FEXTRA
:
# Read & discard the extra field, if present
self
.
_read_exact
(
struct
.
unpack
(
"<H"
,
self
.
_read_exact
(
2
)))
extra_len
,
=
struct
.
unpack
(
"<H"
,
self
.
_read_exact
(
2
))
self
.
_read_exact
(
extra_len
)
if
flag
&
FNAME
:
# Read and discard a null-terminated string containing the filename
while
True
:
...
...
Lib/test/test_gzip.py
Dosyayı görüntüle @
371432b9
...
...
@@ -306,6 +306,13 @@ class TestGzip(unittest.TestCase):
with
gzip
.
GzipFile
(
fileobj
=
io
.
BytesIO
(
truncated
[:
i
]))
as
f
:
self
.
assertRaises
(
EOFError
,
f
.
read
,
1
)
def
test_read_with_extra
(
self
):
# Gzip data with an extra field
gzdata
=
(
b
'
\x1f\x8b\x08\x04\xb2\x17
cQ
\x02\xff
'
b
'
\x05\x00
Extra'
b
'
\x0b
I-.
\x01\x00
2
\xd1
Mx
\x04\x00\x00\x00
'
)
with
gzip
.
GzipFile
(
fileobj
=
io
.
BytesIO
(
gzdata
))
as
f
:
self
.
assertEqual
(
f
.
read
(),
b
'Test'
)
def
test_main
(
verbose
=
None
):
test_support
.
run_unittest
(
TestGzip
)
...
...
Misc/NEWS
Dosyayı görüntüle @
371432b9
...
...
@@ -14,6 +14,8 @@ Core and Builtins
Library
-------
-
Issue
#
17666
:
Fix
reading
gzip
files
with
an
extra
field
.
-
Issue
#
13150
,
#
17512
:
sysconfig
no
longer
parses
the
Makefile
and
config
.
h
files
when
imported
,
instead
doing
it
at
build
time
.
This
makes
importing
sysconfig
faster
and
reduces
Python
startup
time
by
20
%.
...
...
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