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
fc3bfad2
Kaydet (Commit)
fc3bfad2
authored
May 11, 2010
tarafından
Antoine Pitrou
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #8681: Make the zlib module's error messages more informative when
the zlib itself doesn't give any detailed explanation.
üst
37ffc3e3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
4 deletions
+27
-4
test_zlib.py
Lib/test/test_zlib.py
+7
-0
NEWS
Misc/NEWS
+3
-0
zlibmodule.c
Modules/zlibmodule.c
+17
-4
No files found.
Lib/test/test_zlib.py
Dosyayı görüntüle @
fc3bfad2
...
@@ -135,6 +135,13 @@ class CompressTestCase(BaseCompressTestCase, unittest.TestCase):
...
@@ -135,6 +135,13 @@ class CompressTestCase(BaseCompressTestCase, unittest.TestCase):
x
=
zlib
.
compress
(
data
)
x
=
zlib
.
compress
(
data
)
self
.
assertEqual
(
zlib
.
decompress
(
x
),
data
)
self
.
assertEqual
(
zlib
.
decompress
(
x
),
data
)
def
test_incomplete_stream
(
self
):
# An useful error message is given
x
=
zlib
.
compress
(
HAMLET_SCENE
)
self
.
assertRaisesRegexp
(
zlib
.
error
,
"Error -5 while decompressing data: incomplete or truncated stream"
,
zlib
.
decompress
,
x
[:
-
1
])
# Memory use of the following functions takes into account overallocation
# Memory use of the following functions takes into account overallocation
@precisionbigmemtest
(
size
=
_1G
+
1024
*
1024
,
memuse
=
3
)
@precisionbigmemtest
(
size
=
_1G
+
1024
*
1024
,
memuse
=
3
)
...
...
Misc/NEWS
Dosyayı görüntüle @
fc3bfad2
...
@@ -62,6 +62,9 @@ Core and Builtins
...
@@ -62,6 +62,9 @@ Core and Builtins
Library
Library
-------
-------
- Issue #8681: Make the zlib module's error messages more informative when
the zlib itself doesn't give any detailed explanation.
- Issue #8571: Fix an internal error when compressing or decompressing a
- Issue #8571: Fix an internal error when compressing or decompressing a
chunk larger than 1GB with the zlib module's compressor and decompressor
chunk larger than 1GB with the zlib module's compressor and decompressor
objects.
objects.
...
...
Modules/zlibmodule.c
Dosyayı görüntüle @
fc3bfad2
...
@@ -72,10 +72,24 @@ typedef struct
...
@@ -72,10 +72,24 @@ typedef struct
static
void
static
void
zlib_error
(
z_stream
zst
,
int
err
,
char
*
msg
)
zlib_error
(
z_stream
zst
,
int
err
,
char
*
msg
)
{
{
if
(
zst
.
msg
==
Z_NULL
)
const
char
*
zmsg
=
zst
.
msg
;
if
(
zmsg
==
Z_NULL
)
{
switch
(
err
)
{
case
Z_BUF_ERROR
:
zmsg
=
"incomplete or truncated stream"
;
break
;
case
Z_STREAM_ERROR
:
zmsg
=
"inconsistent stream state"
;
break
;
case
Z_DATA_ERROR
:
zmsg
=
"invalid input data"
;
break
;
}
}
if
(
zmsg
==
Z_NULL
)
PyErr_Format
(
ZlibError
,
"Error %d %s"
,
err
,
msg
);
PyErr_Format
(
ZlibError
,
"Error %d %s"
,
err
,
msg
);
else
else
PyErr_Format
(
ZlibError
,
"Error %d %s: %.200s"
,
err
,
msg
,
z
st
.
msg
);
PyErr_Format
(
ZlibError
,
"Error %d %s: %.200s"
,
err
,
msg
,
zmsg
);
}
}
PyDoc_STRVAR
(
compressobj__doc__
,
PyDoc_STRVAR
(
compressobj__doc__
,
...
@@ -248,8 +262,7 @@ PyZlib_decompress(PyObject *self, PyObject *args)
...
@@ -248,8 +262,7 @@ PyZlib_decompress(PyObject *self, PyObject *args)
* process the inflate call() due to an error in the data.
* process the inflate call() due to an error in the data.
*/
*/
if
(
zst
.
avail_out
>
0
)
{
if
(
zst
.
avail_out
>
0
)
{
PyErr_Format
(
ZlibError
,
"Error %i while decompressing data"
,
zlib_error
(
zst
,
err
,
"while decompressing data"
);
err
);
inflateEnd
(
&
zst
);
inflateEnd
(
&
zst
);
goto
error
;
goto
error
;
}
}
...
...
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