[issue45327] json loads is stuck infinitely when the file name is Boolean

Vinayak Hosamani report at bugs.python.org
Thu Sep 30 02:26:57 EDT 2021


New submission from Vinayak Hosamani <vinayakuh at gmail.com>:

Below snippet works fine on Python2

>>> import json
>>> tc_report_file = False
>>> tc_data = json.load(open(tc_report_file))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: coercing to Unicode: need string or buffer, bool found
>>>

as we can see it is throwing an exception

same piece of code is stuck at Python3.8.10

vinayakh at ats-engine:~/stf_files$ python3
Python 3.8.10 (default, Jun  2 2021, 10:49:15)
[GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
>>> import json
>>> tc_report_file = False
>>> tc_data = json.load(open(tc_report_file))

----------
components: Library (Lib)
messages: 402933
nosy: vinayakuh
priority: normal
severity: normal
status: open
title: json loads is stuck infinitely when the file name is Boolean
versions: Python 3.8

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


More information about the Python-bugs-list mailing list