You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
JSON CLI: I/O operation on closed file" when parsing JSON Lines file #132631
There's also an issue with the "in place" functionality. This is captured in a unit test, but there's no mention of this requirement or functionality in the code.
In place can overwrite the current file, but requires special attention.
python -m json.tool example.json example.json
For the in place functionality, it should probably write to a tmp file, then atomically overwrite the original file and delete the tmp file.
The use case of in place and --json-lines is a bit odd (needs --no-indent), but it still should mechanically work and not error out.
Activity
nineteendo commentedon Sep 16, 2025
mpkocher commentedon Sep 16, 2025
There's also an issue with the "in place" functionality. This is captured in a unit test, but there's no mention of this requirement or functionality in the code.
In place can overwrite the current file, but requires special attention.
For the in place functionality, it should probably write to a tmp file, then atomically overwrite the original file and delete the tmp file.
The use case of in place and
--json-linesis a bit odd (needs--no-indent), but it still should mechanically work and not error out.From a file, using
--no-indentcan cleanup a file.In place will break and overwrite the original file and leave an empty file, effectively deleting(!) the original file.
gh-132631: Fix "I/O operation on closed file" when parsing JSON Lines…
[3.14] gh-132631: Fix "I/O operation on closed file" when parsing JSO…
[3.13] gh-132631: Fix "I/O operation on closed file" when parsing JSO…
pythongh-132631: Fix "I/O operation on closed file" when parsing JSON…