Issue 1698917: ZipFile.printdir fix (2.6) (original) (raw)

This issue has been migrated to GitHub: https://github.com/python/cpython/issues/44833

classification

Title: ZipFile.printdir fix (2.6)
Type: Stage:
Components: Library (Lib) Versions: Python 2.6

process

Status: closed Resolution: accepted
Dependencies: Superseder:
Assigned To: Nosy List: alanmcintyre, nnorwitz, rhettinger
Priority: normal Keywords: patch

Created on 2007-04-12 03:27 by alanmcintyre, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
zipfile-printdir-2.6-1.diff alanmcintyre,2007-04-12 03:27 diff against rev 54769
zipfile-printdir-2.diff alanmcintyre,2007-04-19 16:34 Updated to include test
Messages (8)
msg52417 - (view) Author: Alan McIntyre (alanmcintyre) * (Python committer) Date: 2007-04-12 03:27
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
msg52418 - (view) Author: Neal Norwitz (nnorwitz) * (Python committer) Date: 2007-04-19 06:22
Alan, thanks for the patch. Would you create a test case for this?
msg52419 - (view) Author: Alan McIntyre (alanmcintyre) * (Python committer) Date: 2007-04-19 14:52
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.
msg52420 - (view) Author: Alan McIntyre (alanmcintyre) * (Python committer) Date: 2007-04-19 15:59
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.
msg52421 - (view) Author: Alan McIntyre (alanmcintyre) * (Python committer) Date: 2007-04-19 16:34
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
msg59933 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2008-01-14 23:05
Fixed in revision 59959
msg59935 - (view) Author: Alan McIntyre (alanmcintyre) * (Python committer) Date: 2008-01-14 23:08
I think you applied the wrong patch; the referenced revision doesn't include the tests from zipfile-printdir-2.diff.
msg59941 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2008-01-15 00:03
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: +
2007-04-12 03:27:18 alanmcintyre create