A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2003-July/037048.html below:

[Python-Dev] improved zipimport

[Python-Dev] improved zipimportThomas Heller theller@python.net
Tue, 22 Jul 2003 17:25:29 +0200
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




RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4