[issue33927] Allow json.tool to have identical infile and outfile

Pablo Galindo Salgado report at bugs.python.org
Sat Jun 23 15:28:36 EDT 2018


Pablo Galindo Salgado <pablogsal at gmail.com> added the comment:

The current status of json.tool also leaks a file descriptor if you use the same filename or an invalid one (needs debug build to receive this error message):


$ ./python -m json.tool invalid_file.dat nofile.dat
Expecting value: line 1 column 1 (char 0)
sys:1: ResourceWarning: unclosed file <_io.TextIOWrapper name='nofile.dat' mode='w' encoding='UTF-8'>

$ ./python -m json.tool valid.dat valid.dat
Expecting value: line 1 column 1 (char 0)
sys:1: ResourceWarning: unclosed file <_io.TextIOWrapper name='valid.dat' mode='w' encoding='UTF-8'>

----------
nosy: +pablogsal

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue33927>
_______________________________________


More information about the Python-bugs-list mailing list