diff options
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/zipimport.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/Modules/zipimport.c b/Modules/zipimport.c index 141ada5..493e6db 100644 --- a/Modules/zipimport.c +++ b/Modules/zipimport.c @@ -1236,6 +1236,14 @@ get_data(PyObject *archive, PyObject *toc_entry) data = PyObject_CallFunction(decompress, "Oi", raw_data, -15); Py_DECREF(decompress); Py_DECREF(raw_data); + if (data != NULL && !PyBytes_Check(data)) { + PyErr_Format(PyExc_TypeError, + "zlib.decompress() must return a bytes object, not " + "%.200s", + Py_TYPE(data)->tp_name); + Py_DECREF(data); + return NULL; + } return data; eof_error: |