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.

classification
Title: Incorrect documentation for zipfile.writestr()
Type: Stage: resolved
Components: Documentation Versions: Python 3.6, Python 3.5
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: docs@python Nosy List: John Hagen, docs@python, martin.panter, python-dev
Priority: normal Keywords: easy, patch

Created on 2016-06-14 00:42 by John Hagen, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
0001-Fix-ZipFile.writestr-data-argument-name.patch John Hagen, 2016-06-14 23:10
Messages (6)
msg268490 - (view) Author: John Hagen (John Hagen) * Date: 2016-06-14 00:42
The function signature and description for zipfile.writestr is incorrect:

https://docs.python.org/3.5/library/zipfile.html#zipfile.ZipFile.writestr

See:
https://github.com/python/cpython/blob/master/Lib/zipfile.py#L1610

The documentation calls the parameter 'bytes', but the real parameter name is 'data'.

Looks like this was not fixed when the source changed to Python 3:
https://github.com/python/cpython/blob/2.7/Lib/zipfile.py#L1208
msg268495 - (view) Author: Martin Panter (martin.panter) * (Python committer) Date: 2016-06-14 01:06
Looks like you are right. The change in the implementation happened in revision 19196cce1431.
msg268497 - (view) Author: John Hagen (John Hagen) * Date: 2016-06-14 01:12
I'll submit a patch shortly.
msg268590 - (view) Author: John Hagen (John Hagen) * Date: 2016-06-14 23:10
Patch attached.
msg268592 - (view) Author: Martin Panter (martin.panter) * (Python committer) Date: 2016-06-14 23:35
Thanks John
msg268597 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2016-06-15 01:08
New changeset 32af78a8b88f by Martin Panter in branch '3.5':
Issue #27311: Fix ZipFile.writestr data argument name.
https://hg.python.org/cpython/rev/32af78a8b88f

New changeset e3bb87952c62 by Martin Panter in branch 'default':
Issue #27311: Merge zipfile doc from 3.5
https://hg.python.org/cpython/rev/e3bb87952c62
History
Date User Action Args
2022-04-11 14:58:32adminsetgithub: 71498
2016-06-15 01:43:58martin.pantersetstatus: open -> closed
resolution: fixed
stage: commit review -> resolved
2016-06-15 01:08:04python-devsetnosy: + python-dev
messages: + msg268597
2016-06-14 23:35:10martin.pantersetmessages: + msg268592
stage: needs patch -> commit review
2016-06-14 23:10:30John Hagensetfiles: + 0001-Fix-ZipFile.writestr-data-argument-name.patch
keywords: + patch
messages: + msg268590
2016-06-14 01:12:05John Hagensetmessages: + msg268497
2016-06-14 01:06:53martin.pantersetversions: - Python 3.4
nosy: + martin.panter

messages: + msg268495

keywords: + easy
stage: needs patch
2016-06-14 00:42:21John Hagencreate