On Sun, Aug 30, 2009 at 10:40 PM, Jeroen Ruigrok van der Werven <asmodai@in-nomine.org> wrote:
-On [20090831 06:29], Collin Winter (collinw@gmail.com) wrote:
>Are there any applications/frameworks which have zip files on their
>critical path, where this kind of (admittedly impressive) speedup
>would be beneficial? What was the motivation for writing the C
>version?

Would zipped eggs count? For example, SQLAlchemy runs in the 5 MB range.

Unless someone's also pushing for being able to import and execute code from scrambled zip files, no that doesn't matter.

The C code for this should be trivially tiny.  See the zipfile._ZipDecryptor class, its got ~25 lines of actual code in it.  It is not worth arguing about.  I'll commit this if you post it as a patch in a tracker issue.  Please make sure your patch includes the following:

* A unittest that compares the C version of the descrambler to the python version of the descrambler using a variety of inputs and outputs that exercise any boundary condition.

* Conditional import code in the zipfile module itself so that the module works even if the C module isn't available.

-Greg