[Patches] [ python-Patches-914340 ] gzip.GzipFile to accept stream as fileobj.

SourceForge.net noreply at sourceforge.net
Thu Mar 11 15:04:58 EST 2004


Patches item #914340, was opened at 2004-03-11 13:45
Message generated for change (Comment added) made by belyi
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=914340&group_id=5470

Category: Modules
>Group: Python 2.4
Status: Open
Resolution: None
Priority: 5
Submitted By: Igor Belyi (belyi)
Assigned to: Nobody/Anonymous (nobody)
Summary: gzip.GzipFile to accept stream as fileobj.

Initial Comment:
When gzip.GzipFile is initialized with a fileobj which
does not have
tell() and seek() methods (non-rewinding stream) it throws
exception. The interesting thing is that it doesn't
have to. The
following patch updates gzip.py to allow any stream
with just a
read() method to be used. This is helpful if you want
to be able to
do something like:
gzip.GzipFile(fileobj=urllib.urlopen("file:///README.gz")).readlines()
or use GzipFile with sys.stdin stream.

But keep in mind that seek() and rewind() methond of
the GzipFile()
won't for such stream even with the patch.

Igor


----------------------------------------------------------------------

>Comment By: Igor Belyi (belyi)
Date: 2004-03-11 15:04

Message:
Logged In: YES 
user_id=995711

Previous revision of the patch does not work correctly with
mutliple
compressed members in one stream. I've updated the patch file.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=914340&group_id=5470



More information about the Patches mailing list