New submission from Matthew Woodcraft <matt...@woodcraft.me.uk>:

The documentation for json.load() and json.loads() says:

« If the data being deserialized is not a valid JSON document, a 
JSONDecodeError will be raised. »

But this is not currently entirely true: if the data is provided in bytes form 
and is not properly encoded in one of the three accepted encodings, 
UnicodeDecodeError is raised instead.

(I have no opinion on whether the documentation or the behaviour should be 
changed.)

----------
components: Library (Lib)
messages: 387780
nosy: mattheww
priority: normal
severity: normal
status: open
title: json.load() can raise UnicodeDecodeError, but this is not documented
type: behavior
versions: Python 3.10, Python 3.6, Python 3.7, Python 3.8, Python 3.9

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue43340>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to