Serhiy Storchaka added the comment:
LGTM. Perhaps with object_pairs_hook=tuple or object_pairs_hook=dict this test
will look simpler.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17368
Roundup Robot added the comment:
New changeset 4a5ad099b176 by Ezio Melotti in branch '2.7':
#17368: Fix an off-by-one error in the Python JSON decoder that caused a
failure while decoding empty object literals when object_pairs_hook was
specified.
http://hg.python.org/cpython/rev/4a5ad099b176
Ezio Melotti added the comment:
Fixed. I used OrderedDict to make sure that the object hook is actually used.
--
resolution: - fixed
stage: patch review - committed/rejected
status: open - closed
___
Python tracker rep...@bugs.python.org
Ezio Melotti added the comment:
Here's a patch.
--
assignee: - ezio.melotti
keywords: +patch
stage: test needed - patch review
Added file: http://bugs.python.org/file29384/issue17368.diff
___
Python tracker rep...@bugs.python.org
New submission from Aki:
Specifying any object_pairs_hook makes JSON decoding break when JSONObject from
json/decoder.py is used.
Can be emulated easily by setting c_make_scanner = None at json/scanner.py
Example script:
**
import json
test = '{key: value, empty: {}}'
def hook(pairs):
R. David Murray added the comment:
Both the Python version and the C version are supposed to be subject to the
same tests (at least in Python3, I don't remember the state of things in 2.7),
so this probably indicates there is a missing test for this case. Do you have
any interest in trying
Changes by Ezio Melotti ezio.melo...@gmail.com:
--
nosy: +ezio.melotti, serhiy.storchaka
stage: - test needed
type: - behavior
versions: -Python 3.1, Python 3.5
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17368