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
cf5e1d82
Kaydet (Commit)
cf5e1d82
authored
Haz 21, 2012
tarafından
Nadeem Vawda
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Tidy up comments from dd4f7d5c51c7 (zlib compression dictionary support).
üst
a425c3d5
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
8 deletions
+7
-8
test_zlib.py
Lib/test/test_zlib.py
+6
-7
zlibmodule.c
Modules/zlibmodule.c
+1
-1
No files found.
Lib/test/test_zlib.py
Dosyayı görüntüle @
cf5e1d82
...
...
@@ -427,24 +427,23 @@ class CompressObjectTestCase(BaseCompressTestCase, unittest.TestCase):
def
test_dictionary
(
self
):
h
=
HAMLET_SCENE
#
build a simulated dictionary out of the words in HAMLET
#
Build a simulated dictionary out of the words in HAMLET.
words
=
h
.
split
()
random
.
shuffle
(
words
)
zdict
=
b
''
.
join
(
words
)
#
use it to compress HAMLET
#
Use it to compress HAMLET.
co
=
zlib
.
compressobj
(
zdict
=
zdict
)
cd
=
co
.
compress
(
h
)
+
co
.
flush
()
#
verify that it will decompress with the dictionary
#
Verify that it will decompress with the dictionary.
dco
=
zlib
.
decompressobj
(
zdict
=
zdict
)
self
.
assertEqual
(
dco
.
decompress
(
cd
)
+
dco
.
flush
(),
h
)
#
verify that it fails when not given the dictionary
#
Verify that it fails when not given the dictionary.
dco
=
zlib
.
decompressobj
()
self
.
assertRaises
(
zlib
.
error
,
dco
.
decompress
,
cd
)
def
test_dictionary_streaming
(
self
):
# this is simulating the needs of SPDY to be able to reuse the same
# stream object (with its compression state) between sets of compressed
# headers.
# This simulates the reuse of a compressor object for compressing
# several separate data streams.
co
=
zlib
.
compressobj
(
zdict
=
HAMLET_SCENE
)
do
=
zlib
.
decompressobj
(
zdict
=
HAMLET_SCENE
)
piece
=
HAMLET_SCENE
[
1000
:
1500
]
...
...
Modules/zlibmodule.c
Dosyayı görüntüle @
cf5e1d82
...
...
@@ -619,7 +619,7 @@ PyZlib_objdecompress(compobject *self, PyObject *args)
RetVal
=
NULL
;
goto
error
;
}
/*
repeat the call to inflate!
*/
/*
Repeat the call to inflate.
*/
Py_BEGIN_ALLOW_THREADS
err
=
inflate
(
&
(
self
->
zst
),
Z_SYNC_FLUSH
);
Py_END_ALLOW_THREADS
...
...
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