Small bug in zlib module

Andrew M. Kuchling akuchlin at mems-exchange.org
Tue Jun 6 17:45:10 EDT 2000


Peter Schneider-Kamp <petersc at stud.ntnu.no> writes:
> Greg Chapman wrote:
> > I assume PyZlib_decompress should have a check for an empty input string and
> > (if found) should generate an appropriate exception.
> 
> On the current CVS version it immediately (as far as I can see without
> looping) returns with an error.

A puzzling question.  For decompression objects, feeding in an empty
string should certainly *not* produce an error, since it's perfectly
reasonable, if odd, to ask for more decompressed data without
providing more compressed material. It's not obvious whether this is
an error for the decompress function which takes a single string;
you're not providing any compressed data, so you get no decompressed
data.  But realistically, if you're passing "", it's probably a bug.

Similarly, if you parsed the Python source file "" into an AST, is it
an error or would you expect to get None or some similar vacuous tree?

-- 
A.M. Kuchling			http://starship.python.net/crew/amk/
If every man is supposed to think of sex once every nine minutes, what on
earth does he think of in the other eight?
  -- Peter Greenaway, introductory quotation from _8 1/2 Women_ (1999)





More information about the Python-list mailing list