classification
Title: Undocumented change to indent param of json.dump in 3.2
Type: Stage: resolved
Components: Documentation, Library (Lib) Versions: Python 3.2, Python 3.3
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: petri.lehtinen Nosy List: Prashanth.Raghu, bob.ippolito, cvrebert, docs@python, eric.araujo, ezio.melotti, petri.lehtinen, python-dev, r.david.murray, rhettinger, sandro.tosi
Priority: normal Keywords: easy, patch

Created on 2011-04-30 15:47 by eric.araujo, last changed 2012-08-28 09:38 by petri.lehtinen. This issue is now closed.

Files
File name Uploaded Description Edit
versionadded-3.2-json-indent-str.diff eric.araujo, 2011-05-29 17:31 review
issue11964.patch petri.lehtinen, 2012-08-27 19:54 review
Messages (14)
msg134869 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2011-04-30 15:47
I found out that the indent parameter of json.dump was changed in 3.2: it can be a string as well as an int.  The docstring was not updated; the reST doc was, but without a versionchanged directive.

This probably applies to the doc and docstring of the classes implementing dump, too, and there may be other half-documented changes.
msg134876 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2011-04-30 16:14
This change was made by Raymond in issue 5729.  It is the only feature added by that patch; the missing versionchanged was an oversight and I don't think it makes any more likely that other features were added that weren't documented.

If you are updating doc strings, note that there is more than one docstring that mentions indent and all should be updated.
msg134880 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2011-04-30 16:34
> This change was made by Raymond in issue 5729.  It is the only feature
> added by that patch; the missing versionchanged was an oversight and I
> don't think it makes any more likely that other features were added
> that weren't documented.
Ah, I’m relieved, thanks.  I can fix it but I don’t know when I’ll be able to push again.

> If you are updating doc strings, note that there is more than one
> docstring that mentions indent and all should be updated.
I’m aware of that: “This probably applies to the doc and docstring of the classes implementing dump too”.
msg134883 - (view) Author: Prashanth Raghu (Prashanth.Raghu) Date: 2011-04-30 20:25
The .rst file that was downloaded as of 30-04-2011 (dd-mm-yyyy) had the updated doc .
msg135323 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2011-05-06 16:51
I will fix this.

Prashanth Raghu: (sorry to call you by your full name, which is not very nice in my language, but I’m not sure which is your first name) “The .rst file that was downloaded as of 30-04-2011 (dd-mm-yyyy) had the updated doc”: Yes, I saw that, but I reported a lack of versionchanged information (see example near the top of http://docs.python.org/dev/library/site).
msg135918 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2011-05-13 15:27
It turns out that only one documentation block talks about the new indent behavior.  It was easy to add a versionchanged directive to that, but I think a complete patch would fix all mentions of the indent argument, after checking that all of encode/dump/dumps/Encoder.whatnot support the new behavior (there is a test for dumps only, I checked that dump works too but not the other ones).
msg137207 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2011-05-29 17:31
This is my current patch, FYI.
msg169190 - (view) Author: Chris Rebert (cvrebert) * Date: 2012-08-27 07:54
It's been over a year and the patch is trivial. Any chance of it getting applied soon?
msg169202 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2012-08-27 15:34
See my previous message where I say that a careful check is needed.
msg169211 - (view) Author: Petri Lehtinen (petri.lehtinen) * (Python committer) Date: 2012-08-27 19:29
I don't think the test changes are needed, because both dump() and dumps() use JSONEncoder internally, and all current indent testing is done using dumps() anyway.

More important would be to update the documentation of indent for JSONEncoder to match that of dump() and add the versionchanged directives to both.
msg169212 - (view) Author: Petri Lehtinen (petri.lehtinen) * (Python committer) Date: 2012-08-27 19:54
Attached a new patch.
msg169213 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2012-08-27 20:12
LGTM.
msg169259 - (view) Author: Roundup Robot (python-dev) Date: 2012-08-28 09:36
New changeset 5bff555168ab by Petri Lehtinen in branch '3.2':
#11964: Document a change in v3.2 to the json indent parameter
http://hg.python.org/cpython/rev/5bff555168ab

New changeset 0fb511659ef4 by Petri Lehtinen in branch 'default':
#11964: Document a change in v3.2 to the json indent parameter
http://hg.python.org/cpython/rev/0fb511659ef4
msg169260 - (view) Author: Petri Lehtinen (petri.lehtinen) * (Python committer) Date: 2012-08-28 09:38
Fixed, thanks.
History
Date User Action Args
2012-08-28 09:38:04petri.lehtinensetstatus: open -> closed
resolution: fixed
messages: + msg169260

stage: commit review -> resolved
2012-08-28 09:36:42python-devsetnosy: + python-dev
messages: + msg169259
2012-08-27 20:12:29eric.araujosetassignee: eric.araujo -> petri.lehtinen
messages: + msg169213
stage: needs patch -> commit review
2012-08-27 19:54:10petri.lehtinensetfiles: + issue11964.patch

messages: + msg169212
2012-08-27 19:29:33petri.lehtinensetnosy: + petri.lehtinen
messages: + msg169211
2012-08-27 15:34:36eric.araujosetnosy: + sandro.tosi
messages: + msg169202
2012-08-27 07:54:45cvrebertsetnosy: + cvrebert
messages: + msg169190
2011-05-29 17:31:21eric.araujosetfiles: + versionadded-3.2-json-indent-str.diff
keywords: + patch
messages: + msg137207
2011-05-13 15:27:03eric.araujosetmessages: + msg135918
2011-05-06 16:51:07eric.araujosetassignee: docs@python -> eric.araujo
messages: + msg135323
2011-04-30 22:17:41ezio.melottisetnosy: + ezio.melotti
2011-04-30 20:25:47Prashanth.Raghusetnosy: + Prashanth.Raghu
messages: + msg134883
2011-04-30 16:34:12eric.araujosetmessages: + msg134880
2011-04-30 16:14:53r.david.murraysetnosy: + r.david.murray
messages: + msg134876
2011-04-30 15:47:15eric.araujocreate