[Patches] [ python-Patches-443899 ] Minor fix to gzip.py module.
noreply@sourceforge.net
noreply@sourceforge.net
Thu, 16 Aug 2001 13:33:01 -0700
Patches item #443899, was opened at 2001-07-23 12:35
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=305470&aid=443899&group_id=5470
Category: library
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Titus Brown (titus)
Assigned to: Jeremy Hylton (jhylton)
Summary: Minor fix to gzip.py module.
Initial Comment:
---
from cStringIO import StringIO
from gzip import GzipFile
stringFile = StringIO()
gzFile = GzipFile("test1", 'wb', 9, stringFile)
gzFile.write('howdy there!')
r = gzFile.read()
---
the above code fragment gave a nonintuitive error
response (attribute missing). Now, an exception is
raised stating that the file is not opened for reading
or writing.
----------------------------------------------------------------------
>Comment By: Titus Brown (titus)
Date: 2001-08-16 13:33
Message:
Logged In: YES
user_id=23486
Re: context diff, thanks & sorry for the trouble; my newer
patches are being submitted this way.
Re: IOError, I wasn't sure which exception to use at the time.
I therefore took my cue from other code in the gzip module,
which raises a ValueError when self.fileobj is closed.
The only IO errors raised in the module are those that
pertain to incorrect file formats. I'd be happy to change
any and all of the ValueErrors that are raised into
IOErrors, but I think the current consistency of errors
should be maintained ;).
----------------------------------------------------------------------
Comment By: Martin v. Löwis (loewis)
Date: 2001-08-16 11:42
Message:
Logged In: YES
user_id=21627
Please always submit context (-c) or unified (-u) diffs;
I've reformatted your patch by retrieving 1.24, applying
the patch, updating to the current version, and
regenerating the patch.
Apart from that, the patch looks fine to me, and I
recommend to approve it.
One consideration is the exception being raised: Maybe
IOError is more appropriate.
----------------------------------------------------------------------
Comment By: Titus Brown (titus)
Date: 2001-08-14 12:15
Message:
Logged In: YES
user_id=23486
(sorry -- misunderstanding of how the changelog view works)
----------------------------------------------------------------------
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=305470&aid=443899&group_id=5470