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.

Author CharString
Recipients CharString
Date 2021-10-28.12:59:06
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1635425947.02.0.769956758277.issue45644@roundup.psfhosted.org>
In-reply-to
Content
json.tool is very cute and handy for making json readable.

But rewriting a file in place requires tools like sponge (on POSIX) or a tmpfile, because 

$ python -m json.tool foo.json foo.json

results in an empty foo.json.

I propose soaking up the infile before opening the outfile for writing, to prevent that. Much like sort -o does, but without the explicit flag.
The patch I have prepared changes no behaviours, other than preventing an empty file... (still I see this as an enhancement and not a bug fix)
History
Date User Action Args
2021-10-28 12:59:07CharStringsetrecipients: + CharString
2021-10-28 12:59:07CharStringsetmessageid: <1635425947.02.0.769956758277.issue45644@roundup.psfhosted.org>
2021-10-28 12:59:07CharStringlinkissue45644 messages
2021-10-28 12:59:06CharStringcreate