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

2021-09-30 Thread Eric V. Smith


Eric V. Smith  added the comment:

You can demonstrate this without the json module:

# python2
>>> open(False)
Traceback (most recent call last):
  File "", line 1, in 
TypeError: coercing to Unicode: need string or buffer, bool found

# python3
>>> open(False).readlines()

The python3 version doesn't return.

--
nosy: +eric.smith

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



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

2021-09-30 Thread Vinayak Hosamani


New submission from Vinayak Hosamani :

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 "", line 1, in 
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@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 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com