-
-
Notifications
You must be signed in to change notification settings - Fork 33.6k
Closed as duplicate of#132631
Closed as duplicate of#132631
Copy link
Labels
stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Description
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-linesoption with an explicit file should not raise an I/O error. - Add a test for the explicit case for
--json-linesflag and a positional argument tojson.tool.
CPython versions tested on:
3.13
Operating systems tested on:
macOS
Linked PRs
Metadata
Metadata
Assignees
Labels
stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Projects
Status
Done