Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

json.loads raises a SystemError for invalid encoding on 2.7.2 #57983

Closed
Julian mannequin opened this issue Jan 12, 2012 · 4 comments
Closed

json.loads raises a SystemError for invalid encoding on 2.7.2 #57983

Julian mannequin opened this issue Jan 12, 2012 · 4 comments
Labels
stdlib Python modules in the Lib dir

Comments

@Julian
Copy link
Mannequin

Julian mannequin commented Jan 12, 2012

BPO 13774
Nosy @amauryfa, @Julian
Files
  • json_badencoding.patch
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2012-01-13.21:56:01.298>
    created_at = <Date 2012-01-12.00:48:09.992>
    labels = ['library']
    title = 'json.loads raises a SystemError for invalid encoding on 2.7.2'
    updated_at = <Date 2012-01-13.21:56:01.297>
    user = 'https://github.com/Julian'

    bugs.python.org fields:

    activity = <Date 2012-01-13.21:56:01.297>
    actor = 'amaury.forgeotdarc'
    assignee = 'none'
    closed = True
    closed_date = <Date 2012-01-13.21:56:01.298>
    closer = 'amaury.forgeotdarc'
    components = ['Library (Lib)']
    creation = <Date 2012-01-12.00:48:09.992>
    creator = 'Julian'
    dependencies = []
    files = ['24212']
    hgrepos = []
    issue_num = 13774
    keywords = ['patch']
    message_count = 4.0
    messages = ['151100', '151123', '151198', '151199']
    nosy_count = 3.0
    nosy_names = ['amaury.forgeotdarc', 'Julian', 'python-dev']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = 'patch review'
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue13774'
    versions = ['Python 2.7']

    @Julian
    Copy link
    Mannequin Author

    Julian mannequin commented Jan 12, 2012

    >>> 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.

    @Julian Julian mannequin added the stdlib Python modules in the Lib dir label Jan 12, 2012
    @amauryfa
    Copy link
    Member

    Here is a patch

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Jan 13, 2012

    New changeset a9680746ae4a by Amaury Forgeot d'Arc in branch '2.7':
    Issue bpo-13774: json: Fix a SystemError when a bogus encoding is passed to
    http://hg.python.org/cpython/rev/a9680746ae4a

    @amauryfa
    Copy link
    Member

    This will be fixed in the next 2.7.3, thanks for the report!

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    stdlib Python modules in the Lib dir
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant