This patch for 2.5 is in reference to bug [ 1698398 ] - "wrong % of params for format string in ZipFile.printdir()." It makes the following changes: - Modify ZipFile.printdir() to treat the ZipInfo.date_time object in a way that is similar to other code in zipfile.py. - Modified ZipFile.writestr() to pass a 6-item tuple to the ZipInfo constructor (consistent with other treatment of ZipInfo construction in the zipfile module) instead of the full result from time.localtime(). Passes full regrtest.py -r
I would be glad to; is there a preferred way to test the output of a print statement? If I have time today I can go dig around in the stdlib to look for examples of it, but any pointers would be welcome.
I see that there's already a test that checks printdir (it just doesn't check the modified time). I'll work up a modified version of that to check the situation that caused the original bug.
I added a test for printdir. I also updated some comments to reflect that the modified date is now tested, and changed the imports at the top of the test module to conform to PEP8. File Added: zipfile-printdir-2.diff
It was the right solution (a simplified version of the original patch). Will also add more tests when I get a chance. BTW, thanks for reporting this bug.
History
Date
User
Action
Args
2022-04-11 14:56:23
admin
set
github: 44833
2008-01-15 00:03:56
rhettinger
set
messages: +
2008-01-14 23:08:04
alanmcintyre
set
messages: +
2008-01-14 23:05:30
rhettinger
set
status: open -> closednosy: + rhettingerresolution: acceptedmessages: +