[issue11964] Undocumented change to indent param of json.dump in 3.2
![](https://secure.gravatar.com/avatar/fa0f7819f1825f596b384c19aa7dcf33.jpg?s=120&d=mm&r=g)
New submission from Éric Araujo <merwok@netwok.org>: 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. ---------- assignee: docs@python components: Documentation, Library (Lib) keywords: easy messages: 134869 nosy: bob.ippolito, docs@python, eric.araujo, rhettinger priority: normal severity: normal stage: needs patch status: open title: Undocumented change to indent param of json.dump in 3.2 versions: Python 3.2, Python 3.3 _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue11964> _______________________________________
![](https://secure.gravatar.com/avatar/fa0f7819f1825f596b384c19aa7dcf33.jpg?s=120&d=mm&r=g)
R. David Murray <rdmurray@bitdance.com> added the comment: 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. ---------- nosy: +r.david.murray _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue11964> _______________________________________
![](https://secure.gravatar.com/avatar/fa0f7819f1825f596b384c19aa7dcf33.jpg?s=120&d=mm&r=g)
Éric Araujo <merwok@netwok.org> added the comment:
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”.
---------- _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue11964> _______________________________________
![](https://secure.gravatar.com/avatar/fa0f7819f1825f596b384c19aa7dcf33.jpg?s=120&d=mm&r=g)
Prashanth Raghu <p.is.prashanth@gmail.com> added the comment: The .rst file that was downloaded as of 30-04-2011 (dd-mm-yyyy) had the updated doc . ---------- nosy: +Prashanth.Raghu _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue11964> _______________________________________
![](https://secure.gravatar.com/avatar/fa0f7819f1825f596b384c19aa7dcf33.jpg?s=120&d=mm&r=g)
Changes by Ezio Melotti <ezio.melotti@gmail.com>: ---------- nosy: +ezio.melotti _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue11964> _______________________________________
![](https://secure.gravatar.com/avatar/fa0f7819f1825f596b384c19aa7dcf33.jpg?s=120&d=mm&r=g)
Éric Araujo <merwok@netwok.org> added the comment: 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). ---------- assignee: docs@python -> eric.araujo _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue11964> _______________________________________
![](https://secure.gravatar.com/avatar/fa0f7819f1825f596b384c19aa7dcf33.jpg?s=120&d=mm&r=g)
Éric Araujo <merwok@netwok.org> added the comment: 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). ---------- _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue11964> _______________________________________
![](https://secure.gravatar.com/avatar/fa0f7819f1825f596b384c19aa7dcf33.jpg?s=120&d=mm&r=g)
Éric Araujo <merwok@netwok.org> added the comment: This is my current patch, FYI. ---------- keywords: +patch Added file: http://bugs.python.org/file22178/versionadded-3.2-json-indent-str.diff _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue11964> _______________________________________
![](https://secure.gravatar.com/avatar/fa0f7819f1825f596b384c19aa7dcf33.jpg?s=120&d=mm&r=g)
Chris Rebert added the comment: It's been over a year and the patch is trivial. Any chance of it getting applied soon? ---------- nosy: +cvrebert _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue11964> _______________________________________
![](https://secure.gravatar.com/avatar/fa0f7819f1825f596b384c19aa7dcf33.jpg?s=120&d=mm&r=g)
Éric Araujo added the comment: See my previous message where I say that a careful check is needed. ---------- nosy: +sandro.tosi _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue11964> _______________________________________
![](https://secure.gravatar.com/avatar/fa0f7819f1825f596b384c19aa7dcf33.jpg?s=120&d=mm&r=g)
Petri Lehtinen added the comment: 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. ---------- nosy: +petri.lehtinen _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue11964> _______________________________________
![](https://secure.gravatar.com/avatar/fa0f7819f1825f596b384c19aa7dcf33.jpg?s=120&d=mm&r=g)
Petri Lehtinen added the comment: Attached a new patch. ---------- Added file: http://bugs.python.org/file27017/issue11964.patch _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue11964> _______________________________________
![](https://secure.gravatar.com/avatar/fa0f7819f1825f596b384c19aa7dcf33.jpg?s=120&d=mm&r=g)
Éric Araujo added the comment: LGTM. ---------- assignee: eric.araujo -> petri.lehtinen stage: needs patch -> commit review _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue11964> _______________________________________
![](https://secure.gravatar.com/avatar/fa0f7819f1825f596b384c19aa7dcf33.jpg?s=120&d=mm&r=g)
Roundup Robot added the comment: 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 ---------- nosy: +python-dev _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue11964> _______________________________________
![](https://secure.gravatar.com/avatar/fa0f7819f1825f596b384c19aa7dcf33.jpg?s=120&d=mm&r=g)
Petri Lehtinen added the comment: Fixed, thanks. ---------- resolution: -> fixed stage: commit review -> committed/rejected status: open -> closed _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue11964> _______________________________________
participants (7)
-
Chris Rebert
-
Ezio Melotti
-
Petri Lehtinen
-
Prashanth Raghu
-
R. David Murray
-
Roundup Robot
-
Éric Araujo