This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: json.loads raises a SystemError for invalid encoding on 2.7.2
Type: Stage: patch review
Components: Library (Lib) Versions: Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: Julian, amaury.forgeotdarc, python-dev
Priority: normal Keywords: patch

Created on 2012-01-12 00:48 by Julian, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
json_badencoding.patch amaury.forgeotdarc, 2012-01-12 10:17 review
Messages (4)
msg151100 - (view) Author: Julian Berman (Julian) * Date: 2012-01-12 00:48
>>> import json
>>> json.loads("{}", [1, 2, 3])
Traceback (most recent call last):
  File "<input>", line 1, in <module>
  File "/usr/local/Cellar/python/2.7.2/lib/python2.7/json/__init__.py", line 339, in loads
    return cls(encoding=encoding, **kw).decode(s)
  File "/usr/local/Cellar/python/2.7.2/lib/python2.7/json/decoder.py", line 359, in __init__
    self.scan_once = scanner.make_scanner(self)
SystemError: NULL result without error in PyObject_Call

Python 3.2 and 2.6 are not affected it'd seem, so it looks to be 2.7 only.
msg151123 - (view) Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * (Python committer) Date: 2012-01-12 10:16
Here is a patch
msg151198 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2012-01-13 21:54
New changeset a9680746ae4a by Amaury Forgeot d'Arc in branch '2.7':
Issue #13774: json: Fix a SystemError when a bogus encoding is passed to
http://hg.python.org/cpython/rev/a9680746ae4a
msg151199 - (view) Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * (Python committer) Date: 2012-01-13 21:56
This will be fixed in the next 2.7.3, thanks for the report!
History
Date User Action Args
2022-04-11 14:57:25adminsetgithub: 57983
2012-01-13 21:56:01amaury.forgeotdarcsetstatus: open -> closed
resolution: fixed
messages: + msg151199
2012-01-13 21:54:21python-devsetnosy: + python-dev
messages: + msg151198
2012-01-12 10:17:09amaury.forgeotdarcsetfiles: + json_badencoding.patch
keywords: + patch
2012-01-12 10:16:47amaury.forgeotdarcsetnosy: + amaury.forgeotdarc

messages: + msg151123
stage: patch review
2012-01-12 00:48:10Juliancreate