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

SourceForge.net noreply at sourceforge.net
Thu Mar 11 14:09:45 EST 2004


Patches item #914358, was opened at 2004-03-11 14:09
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=914358&group_id=5470

Category: Modules
Group: Python 2.3
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


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

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



More information about the Patches mailing list