Łukasz Langa <[email protected]> added the comment:
I agree with Serhiy that in general the fact that json.tool crashes here is
useful: similarly to an exception in Python code, it can inform the user that
some data they feed to json.tool is invalid.
At the same time, I find it a bit obnoxious that the current implementation
doesn't allow for the *final character* of the input to be a newline (or
"characters" in case of \r\n... but it should still only ignore *a single
effective newline*).
I mean, if the user starts spewing newlines in the middle of the file... that
might easily be an error. If the file ends with 5 empty lines, that might
easily be an error. But, if the file really is:
{'line': 1, 'data': ...}\n
{'line': 2, 'data': ...}\n
{'line': 3, 'data': ...}\n
I think that should be pragmatically accepted by json.tool, especially since
many text editors now add newline characters at file ends.
----------
nosy: +lukasz.langa
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue45929>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com