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, lukasz.langa, miss-islington, remi.lapeyre
Date 2021-11-08.09:06:27
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1636362387.62.0.53098767367.issue45644@roundup.psfhosted.org>
In-reply-to
Content
@Remi

I left the current behaviour for --json-lines untouched, on purpose.
My reasoning was that the json-lines format is often seen in JSON streaming, and I didn't want to break the case where the input is an endless stream from stdin or a named pipe. And to keep the patch simple with minimal change to the exposed interface.

Simplest fix for the case in this current code would be: iff infile equals outfile (minding their types), call list(objs) on the generator[1] to materialise it in one go. The only case where that would break would be when infile == outfile and is a named pipe, but I can't imagine why I would want to both read and write to the same FIFO, other than comedic effect.

  [1] https://github.com/python/cpython/blob/122ca4d73faba279a579aa2011fa34661ce537a2/Lib/json/tool.py#L65
History
Date User Action Args
2021-11-08 09:06:27CharStringsetrecipients: + CharString, lukasz.langa, miss-islington, remi.lapeyre
2021-11-08 09:06:27CharStringsetmessageid: <1636362387.62.0.53098767367.issue45644@roundup.psfhosted.org>
2021-11-08 09:06:27CharStringlinkissue45644 messages
2021-11-08 09:06:27CharStringcreate