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
04f17f10
Kaydet (Commit)
04f17f10
authored
Eki 31, 2016
tarafından
Serhiy Storchaka
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #27517: LZMA compressor and decompressor no longer raise exceptions if
given empty data twice. Patch by Benjamin Fogle.
üst
0bcd89b8
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
47 additions
and
0 deletions
+47
-0
test_lzma.py
Lib/test/test_lzma.py
+38
-0
ACKS
Misc/ACKS
+1
-0
NEWS
Misc/NEWS
+3
-0
_lzmamodule.c
Modules/_lzmamodule.c
+5
-0
No files found.
Lib/test/test_lzma.py
Dosyayı görüntüle @
04f17f10
...
...
@@ -136,6 +136,21 @@ class CompressorDecompressorTestCase(unittest.TestCase):
self
.
assertTrue
(
lzd
.
eof
)
self
.
assertEqual
(
lzd
.
unused_data
,
b
""
)
def
test_decompressor_chunks_empty
(
self
):
lzd
=
LZMADecompressor
()
out
=
[]
for
i
in
range
(
0
,
len
(
COMPRESSED_XZ
),
10
):
self
.
assertFalse
(
lzd
.
eof
)
out
.
append
(
lzd
.
decompress
(
b
''
))
out
.
append
(
lzd
.
decompress
(
b
''
))
out
.
append
(
lzd
.
decompress
(
b
''
))
out
.
append
(
lzd
.
decompress
(
COMPRESSED_XZ
[
i
:
i
+
10
]))
out
=
b
""
.
join
(
out
)
self
.
assertEqual
(
out
,
INPUT
)
self
.
assertEqual
(
lzd
.
check
,
lzma
.
CHECK_CRC64
)
self
.
assertTrue
(
lzd
.
eof
)
self
.
assertEqual
(
lzd
.
unused_data
,
b
""
)
def
test_decompressor_chunks_maxsize
(
self
):
lzd
=
LZMADecompressor
()
max_length
=
100
...
...
@@ -273,6 +288,16 @@ class CompressorDecompressorTestCase(unittest.TestCase):
lzd
=
LZMADecompressor
(
lzma
.
FORMAT_RAW
,
filters
=
FILTERS_RAW_4
)
self
.
_test_decompressor
(
lzd
,
cdata
,
lzma
.
CHECK_NONE
)
def
test_roundtrip_raw_empty
(
self
):
lzc
=
LZMACompressor
(
lzma
.
FORMAT_RAW
,
filters
=
FILTERS_RAW_4
)
cdata
=
lzc
.
compress
(
INPUT
)
cdata
+=
lzc
.
compress
(
b
''
)
cdata
+=
lzc
.
compress
(
b
''
)
cdata
+=
lzc
.
compress
(
b
''
)
cdata
+=
lzc
.
flush
()
lzd
=
LZMADecompressor
(
lzma
.
FORMAT_RAW
,
filters
=
FILTERS_RAW_4
)
self
.
_test_decompressor
(
lzd
,
cdata
,
lzma
.
CHECK_NONE
)
def
test_roundtrip_chunks
(
self
):
lzc
=
LZMACompressor
()
cdata
=
[]
...
...
@@ -283,6 +308,19 @@ class CompressorDecompressorTestCase(unittest.TestCase):
lzd
=
LZMADecompressor
()
self
.
_test_decompressor
(
lzd
,
cdata
,
lzma
.
CHECK_CRC64
)
def
test_roundtrip_empty_chunks
(
self
):
lzc
=
LZMACompressor
()
cdata
=
[]
for
i
in
range
(
0
,
len
(
INPUT
),
10
):
cdata
.
append
(
lzc
.
compress
(
INPUT
[
i
:
i
+
10
]))
cdata
.
append
(
lzc
.
compress
(
b
''
))
cdata
.
append
(
lzc
.
compress
(
b
''
))
cdata
.
append
(
lzc
.
compress
(
b
''
))
cdata
.
append
(
lzc
.
flush
())
cdata
=
b
""
.
join
(
cdata
)
lzd
=
LZMADecompressor
()
self
.
_test_decompressor
(
lzd
,
cdata
,
lzma
.
CHECK_CRC64
)
# LZMADecompressor intentionally does not handle concatenated streams.
def
test_decompressor_multistream
(
self
):
...
...
Misc/ACKS
Dosyayı görüntüle @
04f17f10
...
...
@@ -446,6 +446,7 @@ Frederik Fix
Tom Flanagan
Matt Fleming
Hernán Martínez Foffani
Benjamin Fogle
Artem Fokin
Arnaud Fontaine
Michael Foord
...
...
Misc/NEWS
Dosyayı görüntüle @
04f17f10
...
...
@@ -113,6 +113,9 @@ Core and Builtins
Library
-------
- Issue #27517: LZMA compressor and decompressor no longer raise exceptions if
given empty data twice. Patch by Benjamin Fogle.
- Issue #28549: Fixed segfault in curses'
s
addch
()
with
ncurses6
.
-
Issue
#
28449
:
tarfile
.
open
()
with
mode
"r"
or
"r:"
now
tries
to
open
a
tar
...
...
Modules/_lzmamodule.c
Dosyayı görüntüle @
04f17f10
...
...
@@ -527,6 +527,8 @@ compress(Compressor *c, uint8_t *data, size_t len, lzma_action action)
Py_BEGIN_ALLOW_THREADS
lzret
=
lzma_code
(
&
c
->
lzs
,
action
);
data_size
=
(
char
*
)
c
->
lzs
.
next_out
-
PyBytes_AS_STRING
(
result
);
if
(
lzret
==
LZMA_BUF_ERROR
&&
len
==
0
&&
c
->
lzs
.
avail_out
>
0
)
lzret
=
LZMA_OK
;
/* That wasn't a real error */
Py_END_ALLOW_THREADS
if
(
catch_lzma_error
(
lzret
))
goto
error
;
...
...
@@ -906,6 +908,9 @@ decompress_buf(Decompressor *d, Py_ssize_t max_length)
PyObject
*
result
;
lzma_stream
*
lzs
=
&
d
->
lzs
;
if
(
lzs
->
avail_in
==
0
)
return
PyBytes_FromStringAndSize
(
NULL
,
0
);
if
(
max_length
<
0
||
max_length
>=
INITIAL_BUFFER_SIZE
)
result
=
PyBytes_FromStringAndSize
(
NULL
,
INITIAL_BUFFER_SIZE
);
else
...
...
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