[Patches] [ python-Patches-462635 ] Fix bugs in new encodings

noreply@sourceforge.net noreply@sourceforge.net
Thu, 20 Sep 2001 03:34:49 -0700


Patches item #462635, was opened at 2001-09-18 12:13
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=305470&aid=462635&group_id=5470

Category: Library (Lib)
Group: None
>Status: Closed
>Resolution: Accepted
Priority: 6
Submitted By: A.M. Kuchling (akuchling)
Assigned to: M.-A. Lemburg (lemburg)
Summary: Fix bugs in new encodings

Initial Comment:
Attempting to open a stream using the new 
uu/zlib/base64/etc encodings doesn't work.

>>> import codecs
>>> f=codecs.open('foo.gz', 'wb', encoding='zlib')
>>> f.write('Output goes here. ' * 10)
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "/home/akuchlin/src/python/Lib/codecs.py", 
line 338, in write
    return self.writer.write(data)
  File "/home/akuchlin/src/python/Lib/codecs.py", 
line 137, in write
    data, consumed = self.encode(object, self.errors)
TypeError: zlib_encode() takes at most 2 arguments (3 
given)

Python is returning a bound method for self.encode,
so it's short by one argument.  The supplied patch 
fixes this; there should also be a test case added to 
the test suite to exercise this code.



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

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