This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author xuanji
Recipients docs@python, vstinner, xuanji
Date 2011-02-09.15:09:00
SpamBayes Score 7.723425e-08
Marked as misclassified No
Message-id <1297264140.97.0.306129367766.issue11160@psf.upfronthosting.co.za>
In-reply-to
Content
The documentation for zipfile describes ZipFile.comment as "The comment text associated with the ZIP file." From reading this I expect that setting it to a string is ok; however ZipFile.comment must actually be set to bytes (or a bytes-like object, I am not very sure).

This may also unexpectedly affect old code because I saw one patch on the bug tracker that was written just last year that set ZipFile.comment to a string. 

IMO there are 2 ways to fix:

1) Change docs to mention that ZipFile.comment only accepts bytes
2) Patch zipfile.py to accept string and try to convert, throwing an error if the conversion fails
History
Date User Action Args
2011-02-09 15:09:01xuanjisetrecipients: + xuanji, vstinner, docs@python
2011-02-09 15:09:00xuanjisetmessageid: <1297264140.97.0.306129367766.issue11160@psf.upfronthosting.co.za>
2011-02-09 15:09:00xuanjilinkissue11160 messages
2011-02-09 15:09:00xuanjicreate