Bug report
Bug description:
When using python -m json.tool --json-lines example.jline, the file handle is closed before the generator is consumed.
>> python --version
Python 3.13.2
>> cat example.jline
{"name": "Gilbert", "session": "2013", "score": 24, "completed": true}
{"name": "Alexa", "session": "2013", "score": 29, "completed": true}
{"name": "May", "session": "2012B", "score": 14, "completed": false}
{"name": "Deloise", "session": "2012A", "score": 19, "completed": true}
>> python -m json.tool --json-lines example.jline
I/O operation on closed file.
>> echo $?
Requirements:
- The --json-lines option with an explicit file should not raise an I/O error.
- Add a test for the explicit case for --json-lines flag and a positional argument to json.tool.
CPython versions tested on:
3.13
Operating systems tested on:
macOS
Linked PRs
Reactions are currently unavailable
Bug report
Bug description:
When using python -m json.tool --json-lines example.jline, the file handle is closed before the generator is consumed.
Requirements:
CPython versions tested on:
3.13
Operating systems tested on:
macOS
Linked PRs