classification
Title: Convert some debugging prints in zipfile to warnings
Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 3.4, Python 3.3, Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: serhiy.storchaka Nosy List: alanmcintyre, benjamin.peterson, georg.brandl, larry, meador.inge, python-dev, serhiy.storchaka
Priority: normal Keywords: patch

Created on 2014-01-14 20:56 by serhiy.storchaka, last changed 2014-01-20 20:22 by serhiy.storchaka. This issue is now closed.

Files
File name Uploaded Description Edit
zipfile_warnings.patch serhiy.storchaka, 2014-01-14 20:56 review
Messages (8)
msg208112 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2014-01-14 20:56
When ZipFile.debug is not zero, some debugging messages are printed to stdout. Some of them are for debugging the zipfile module itself. But some are warnings about user's operation which perhaps make not what the user is expected -- truncating long archive comment or adding a file with duplicated name. These cases cases can be considered as logic error, they can be prevented by external checks (check that comment's length does not excite the limit and that specified name is not in the ZIP file). So it will be sane and helpful to convert these prints to regular warnings, which are controlled in same way as all other warnings.

See also issue2824. It have a patch which looks too excessive to me.

Here is a patch. I don't sure to which version it should be targeted.
msg208137 - (view) Author: Meador Inge (meador.inge) * (Python committer) Date: 2014-01-15 03:49
LGTM.

I audited the other 'ZipFile.debug' uses and agree that the others are
mainly useful in debugging the zipfile implementation itself.

Since it isn't that critical of a change, the default branch should be
sufficient.
msg208173 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2014-01-15 16:10
I'm not sure. This is why I had added Larry and Georg to nosy list. This issue looks in a half-way between fixing a bug and adding new feature.
msg208182 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2014-01-15 19:00
I'm actually more on the "fixing a bug" side.  For me this is fine for 3.3.
msg208250 - (view) Author: Larry Hastings (larry) * (Python committer) Date: 2014-01-16 07:59
I will bow to the wisdom of my predecessor and accept this patch for beta 3.
msg208275 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2014-01-16 12:10
Well, then I should only ask Benjamin.
msg208569 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2014-01-20 19:40
Benjamin just have approved it for 2.7.
msg208575 - (view) Author: Roundup Robot (python-dev) Date: 2014-01-20 20:14
New changeset 208fa45672c2 by Serhiy Storchaka in branch '2.7':
Issue #20262: Warnings are raised now when duplicate names are added in the
http://hg.python.org/cpython/rev/208fa45672c2

New changeset 9fda6658c01a by Serhiy Storchaka in branch '3.3':
Issue #20262: Warnings are raised now when duplicate names are added in the
http://hg.python.org/cpython/rev/9fda6658c01a

New changeset f7cebf727bc6 by Serhiy Storchaka in branch 'default':
Issue #20262: Warnings are raised now when duplicate names are added in the
http://hg.python.org/cpython/rev/f7cebf727bc6
History
Date User Action Args
2014-01-20 20:22:28serhiy.storchakasetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2014-01-20 20:14:05python-devsetnosy: + python-dev
messages: + msg208575
2014-01-20 19:40:13serhiy.storchakasetassignee: serhiy.storchaka
messages: + msg208569
versions: + Python 2.7
2014-01-16 12:10:45serhiy.storchakasetnosy: + benjamin.peterson

messages: + msg208275
versions: + Python 3.3, Python 3.4
2014-01-16 07:59:28larrysetmessages: + msg208250
2014-01-15 19:00:46georg.brandlsetmessages: + msg208182
2014-01-15 16:10:36serhiy.storchakasetmessages: + msg208173
2014-01-15 03:49:55meador.ingesettype: behavior

messages: + msg208137
nosy: + meador.inge
2014-01-14 20:56:35serhiy.storchakacreate