[issue41852] Inconsistent errors for JSON-encoding NaNs with allow_nan=False

2020-09-24 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- nosy: +serhiy.storchaka ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https

[issue41852] Inconsistent errors for JSON-encoding NaNs with allow_nan=False

2020-09-24 Thread Ben Kurtovic
New submission from Ben Kurtovic : json.dump vs. json.dumps have inconsistent error messages when encoding NaN with allow_nan=False: >>> json.dumps(float('nan'), allow_nan=False) ValueError: Out of range float values are not JSON compliant >>> json.dump(float('nan'), sys.stdout, allow_nan=Fals