This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Oren Milman
Recipients Oren Milman
Date 2017-09-27.06:24:51
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1506493491.46.0.154975027568.issue31602@psf.upfronthosting.co.za>
In-reply-to
Content
The following code causes an assertion failure (in case there exists a
compressed zip file named 'foo.zip' with a file called 'bar.py' in it):

import zlib
import zipimport
def bad_decompress(*args):
    return None

zlib.decompress = bad_decompress
zipimport.zipimporter('foo.zip').get_source('bar')


This is because get_data() (in Modules/zipimport.c) assumes that
zlib.decompress() returned a bytes object, and returns it.
zipimport_zipimporter_get_source_impl() assumes that get_data() returned a
bytes object, and passes it to PyBytes_AS_STRING(), which asserts it is a bytes
object.
History
Date User Action Args
2017-09-27 06:24:51Oren Milmansetrecipients: + Oren Milman
2017-09-27 06:24:51Oren Milmansetmessageid: <1506493491.46.0.154975027568.issue31602@psf.upfronthosting.co.za>
2017-09-27 06:24:51Oren Milmanlinkissue31602 messages
2017-09-27 06:24:51Oren Milmancreate