[issue26229] Make number serialization ES6/V8 compatible

2016-02-02 Thread Anders Rundgren
Anders Rundgren added the comment: In ES6/V8-compatible implementations which include "node.js", Chrome, Firefox, Safari and (of course) my Java reference implementation you can take a cryptographic hash of a JSON object with a predictable result. That is, this request is in no way limited to

[issue26229] Make number serialization ES6/V8 compatible

2016-02-02 Thread Anders Rundgren
Anders Rundgren added the comment: An easier fix than mucking around in the pretty complex number serializer code would be adding an "ES6Format" option to the "json.dump*" methods which could use the supplied conversion code as is. For JSON parsing in an ES6-compatible way you must anyway use

[issue26229] Make number serialization ES6/V8 compatible

2016-02-02 Thread Mark Dickinson
Mark Dickinson added the comment: > For JSON parsing in an ES6-compatible way you must anyway use an > "OrderedDict" hook option to get the right (=original) property order. Why? From the JSON spec: "An object is an *unordered* set of name/value pairs." (emphasis mine). What do you mean by

[issue26229] Make number serialization ES6/V8 compatible

2016-02-02 Thread Mark Dickinson
Mark Dickinson added the comment: > An easier fix than mucking around in the pretty complex number serializer > code would be adding an "ES6Format" option to the "json.dump*" methods > which could use the supplied conversion code as is. Certainly if this were added we'd want to do it in a

[issue26229] Make number serialization ES6/V8 compatible

2016-01-30 Thread Anders Rundgren
Anders Rundgren added the comment: As I said, the problem is close to fixed in 3.5. You should not consider the JCS specification as the [sole] target but the ability to creating a normalized JSON object which has many uses including calculating a hash of such objects.

[issue26229] Make number serialization ES6/V8 compatible

2016-01-29 Thread Eric V. Smith
Eric V. Smith added the comment: Do you have a pointer to the spec which requires -0 vs. -3.333e+20, for example? -- nosy: +eric.smith ___ Python tracker

[issue26229] Make number serialization ES6/V8 compatible

2016-01-29 Thread Mark Dickinson
Mark Dickinson added the comment: Eric: I suspect he's talking about section 7.1.12.1 of the 6th edition of ECMA-262; a PDF can be found here: http://www.ecma-international.org/ecma-262/6.0/ECMA-262.pdf. Clause 6 applies to this particular example: """ If k <= n <= 21, return the String

[issue26229] Make number serialization ES6/V8 compatible

2016-01-29 Thread Mark Dickinson
Changes by Mark Dickinson : -- nosy: +mark.dickinson ___ Python tracker ___ ___

[issue26229] Make number serialization ES6/V8 compatible

2016-01-29 Thread Mark Dickinson
Mark Dickinson added the comment: Here's the relevant part of the JCS document, from Appendix A of https://cyberphone.github.io/openkeystore/resources/docs/jcs.html#ECMAScript_Compatibility_Mode: """ Numbers *must* be expressed as specified by EMCAScript [ES6] using the improved serialization

[issue26229] Make number serialization ES6/V8 compatible

2016-01-29 Thread Antoine Pitrou
Antoine Pitrou added the comment: That said, someone interested in this should probably voice their concerns towards the JCS standardizers, as the restrictions it imposes on number serialization are clearly an impediment to implementing their protocol. --

[issue26229] Make number serialization ES6/V8 compatible

2016-01-28 Thread SilentGhost
Changes by SilentGhost : -- components: +Extension Modules -Interpreter Core nosy: +ezio.melotti, pitrou, rhettinger versions: +Python 3.6 -Python 3.5 ___ Python tracker

[issue26229] Make number serialization ES6/V8 compatible

2016-01-27 Thread Anders Rundgren
New submission from Anders Rundgren: ECMA has in their latest release defined that JSON elements must be ordered during serialization. This is easy to accomplish using Python's OrderedDict. What is less trivial is that numbers have to be formatted in a certain way as well. I have tested