[Python-Dev] Request for Pronouncement: PEP 441 - Improving Python ZIP Application Support

Brett Cannon brett at python.org
Mon Feb 23 19:40:21 CET 2015


On Mon Feb 23 2015 at 1:34:03 PM Daniel Holth <dholth at gmail.com> wrote:

> On Mon, Feb 23, 2015 at 1:16 PM, Brett Cannon <brett at python.org> wrote:
> > Overall I like this and don't see any reason not to accept it, so +1. I
> do
> > have a couple comments/questions on the module API, though.
> >
> > On Mon Feb 23 2015 at 12:45:28 PM Paul Moore <p.f.moore at gmail.com>
> wrote:
> >>
> >> <SNIP>
> >>
> >>
> >> ``set_interpreter(archive, new_archive, interpreter=None)``
> >> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> >>
> >> Modifies the *archive*'s shebang line to contain the specified
> >> interpreter, and writes the updated archive to *new_archive*.  If the
> >> *interpreter* is ``None``, removes the shebang line.
> >
> >
> > Should new_archive default to None to allow for in-place editing?
> >
> > -Brett
>
> That would be cool but more work. Unless the length of the new shebang
> is <= the old one, the zip file contents have to be moved out of the
> way.
>

Couldn't you just keep it in memory as bytes and then write directly over
the file? I realize that's a bit wasteful memory-wise but it is possible.
The docs could mention the memory cost is something to watch out for when
doing an in-place replacement. Heck the code could even make it an
io.BytesIO instance so the rest of the code doesn't have to care about this
special case.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20150223/2b058fba/attachment.html>


More information about the Python-Dev mailing list