[Python-Dev] improved zipimport (original) (raw)
Thomas Heller theller@python.net
Tue, 22 Jul 2003 17:25:29 +0200
- Previous message: [Python-Dev] improved zipimport
- Next message: [Python-Dev] improved zipimport
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Barry Warsaw <barry@python.org> writes:
On Tue, 2003-07-22 at 10:43, Thomas Heller wrote:
Is it too late to get this small patch in?
<http://www.python.org/sf/775637> I'm hesitating to raise the priority... I'm not a zipimport export but the description seems to imply it's a new feature not a bug fix.
There are several ways to argue that is is a bug fix: zipimport.c doesn't handle zip files which are no problem for the zipfile module.
zipimport.c, as it is now, looks for the endof_central_dir header relative to the end of the file:
fseek(fp, -22, SEEK_END);
header_end = ftell(fp);
if (fread(endof_central_dir, 1, 22, fp) != 22) {
...
but then goes on positioning relative to the start of the file:
fseek(fp, header_offset, 0); /* Start of file header */
l = PyMarshal_ReadLongFromFile(fp);
if (l != 0x02014B50)
break; /* Bad: Central Dir File Header */
OTOH, fixing this 'bug' allows py2exe using the zipimport hook.
Thanks,
Thomas
- Previous message: [Python-Dev] improved zipimport
- Next message: [Python-Dev] improved zipimport
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]