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
0cc4fd9d
Kaydet (Commit)
0cc4fd9d
authored
May 14, 2011
tarafından
Nadeem Vawda
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #12050: zlib.decompressobj().decompress() now clears the unconsumed_tail
attribute when called without a max_length argument.
üst
9b323a52
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
7 deletions
+24
-7
test_zlib.py
Lib/test/test_zlib.py
+9
-0
NEWS
Misc/NEWS
+3
-0
zlibmodule.c
Modules/zlibmodule.c
+12
-7
No files found.
Lib/test/test_zlib.py
Dosyayı görüntüle @
0cc4fd9d
...
...
@@ -310,6 +310,15 @@ class CompressObjectTestCase(BaseCompressTestCase, unittest.TestCase):
self
.
assertRaises
(
ValueError
,
dco
.
decompress
,
""
,
-
1
)
self
.
assertEqual
(
''
,
dco
.
unconsumed_tail
)
def
test_clear_unconsumed_tail
(
self
):
# Issue #12050: calling decompress() without providing max_length
# should clear the unconsumed_tail attribute.
cdata
=
"x
\x9c
KLJ
\x06\x00\x02
M
\x01
"
# "abc"
dco
=
zlib
.
decompressobj
()
ddata
=
dco
.
decompress
(
cdata
,
1
)
ddata
+=
dco
.
decompress
(
dco
.
unconsumed_tail
)
self
.
assertEqual
(
dco
.
unconsumed_tail
,
""
)
def
test_flushes
(
self
):
# Test flush() with the various options, using all the
# different levels in order to provide more variations.
...
...
Misc/NEWS
Dosyayı görüntüle @
0cc4fd9d
...
...
@@ -80,6 +80,9 @@ Core and Builtins
Library
-------
- Issue #12050: zlib.decompressobj().decompress() now clears the unconsumed_tail
attribute when called without a max_length argument.
- Issue #12062: In the `io` module, fix a flushing bug when doing a certain
type of I/O sequence on a file opened in read+write mode (namely: reading,
seeking a bit forward, writing, then seeking before the previous write but
...
...
Modules/zlibmodule.c
Dosyayı görüntüle @
0cc4fd9d
...
...
@@ -535,17 +535,22 @@ PyZlib_objdecompress(compobject *self, PyObject *args)
Py_END_ALLOW_THREADS
}
/* Not all of the compressed data could be accommodated in the output buffer
of specified size. Return the unconsumed tail in an attribute.*/
if
(
max_length
)
{
/* Not all of the compressed data could be accommodated in a buffer of
the specified size. Return the unconsumed tail in an attribute. */
Py_DECREF
(
self
->
unconsumed_tail
);
self
->
unconsumed_tail
=
PyString_FromStringAndSize
((
char
*
)
self
->
zst
.
next_in
,
self
->
zst
.
avail_in
);
if
(
!
self
->
unconsumed_tail
)
{
Py_DECREF
(
RetVal
);
RetVal
=
NULL
;
goto
error
;
}
}
else
if
(
PyString_GET_SIZE
(
self
->
unconsumed_tail
)
>
0
)
{
/* All of the compressed data was consumed. Clear unconsumed_tail. */
Py_DECREF
(
self
->
unconsumed_tail
);
self
->
unconsumed_tail
=
PyString_FromStringAndSize
(
""
,
0
);
}
if
(
!
self
->
unconsumed_tail
)
{
Py_DECREF
(
RetVal
);
RetVal
=
NULL
;
goto
error
;
}
/* The end of the compressed data has been reached, so set the
...
...
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