[issue26724] Serialize dict with non-string keys to JSON — unexpected result

Raymond Hettinger report at bugs.python.org
Sat Apr 9 20:07:55 EDT 2016


Raymond Hettinger added the comment:

I think etrepum's comment on Aug 27, 2013 display's sound reasoning:
'''
I expect that this error checking feature would be expensive to implement (both in runtime cost and lines of code). I think the most sensible thing to do would be to just mention this in the docs, or do nothing. In the past ~8 years, this is the only time this potential issue has ever been brought up here. It's not technically invalid JSON, but the decode semantics aren't well defined by the spec.
'''

 
I think this should be closed as "not a bug" since the semantics aren't well defined and because currently deployed code may rely on the behavior which isn't unreasonable or shocking. In general, Python tools aim more for practicality than for lint-like advisories about all possible input oddities.

----------
assignee:  -> bob.ippolito
nosy: +bob.ippolito, rhettinger
priority: normal -> low

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue26724>
_______________________________________


More information about the Python-bugs-list mailing list