[issue10019] json.dumps with indent = 0 not adding newlines
Bob Ippolito added the comment: The test in the patch assumes a specific iteration order for the dict "h", changing the dict to have only one key would fix this problem with the test. -- ___ Python tracker <http://bugs.python.org/issue10019> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10019] json.dumps with indent = 0 not adding newlines
Bob Ippolito added the comment: The test also repeats an equivalent dict to "h" in the check function. -- ___ Python tracker <http://bugs.python.org/issue10019> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10019] json.dumps with indent = 0 not adding newlines
Bob Ippolito added the comment: I just applied a version of this patch with corrections to the tests here: http://code.google.com/p/simplejson/source/detail?r=234 -- ___ Python tracker <http://bugs.python.org/issue10019> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue5729] Allows tabs for indenting JSON output
Bob Ippolito added the comment: Sorry but I don't think I will be able to. I'd be happy to accept patches into simplejson that make it easier to merge with Python 3 in the future, but I simply do not have the time to maintain the Python 3 branch of the code that we don't use. -- ___ Python tracker <http://bugs.python.org/issue5729> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11844] Update json to upstream simplejson latest release
Bob Ippolito added the comment: That's not a problem, I'm more than happy to give permission for any patch. If it's easier I can consider dual-licensing in the simplejson source. -- ___ Python tracker <http://bugs.python.org/issue11844> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue5723] Incomplete json tests
Bob Ippolito added the comment: I did this some time ago in simplejson by defining a TestSuite subclass and instrumenting simplejson so that speedups can be enabled and disabled easily with a private API. https://github.com/simplejson/simplejson/blob/master/simplejson/tests/__init__.py -- ___ Python tracker <http://bugs.python.org/issue5723> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue9233] json.load failure when C optimizations aren't built
Bob Ippolito added the comment: For what it's worth, I don't think any of the failures mentioned here are in the current version of simplejson. There aren't any tests that check the speedup module name, the speedup tests are skipped when speedups are not detected, and the empty json object bug was fixed in June 2009. http://code.google.com/p/simplejson/issues/detail?id=57 -- ___ Python tracker <http://bugs.python.org/issue9233> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue3322] bugs in scanstring_str() and scanstring_unicode() of _json module
Bob Ippolito <[EMAIL PROTECTED]> added the comment: Am I to understand that the bug here is that the C extension doesn't validate input properly if you call into it directly? Without a test I'm not entirely sure exactly how you could possibly get negative values into those functions using the json module as-is. ___ Python tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue3322> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue3322] bugs in scanstring_str() and scanstring_unicode() of _json module
Bob Ippolito <[EMAIL PROTECTED]> added the comment: I've audited the patch, while it does fix the input range it looks like it regresses other things (at least the error messages). "begin" was intentionally used. The patch is not suitable for use, I'll create a minimal patch that just fixes input validation. ___ Python tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue3322> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue3322] bugs in scanstring_str() and scanstring_unicode() of _json module
Bob Ippolito <[EMAIL PROTECTED]> added the comment: I just committed a fix to trunk in r65147, needs port to py3k? -- assignee: bob.ippolito -> georg.brandl ___ Python tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue3322> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue3623] _json: fix raise_errmsg(), py_encode_basestring_ascii() and linecol()
Bob Ippolito <[EMAIL PROTECTED]> added the comment: That patch looks ok to me, but I'm not at all familiar with the changes in python 3.0 yet. Is this something that needs to be backported to 2.6? ___ Python tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue3623> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue3623] _json: fix raise_errmsg(), py_encode_basestring_ascii() and linecol()
Bob Ippolito <[EMAIL PROTECTED]> added the comment: I applied the changes proposed in _json26.patch to simplejson and they worked perfectly fine. Again I'm not the best judge of python 3.0 code because I have not made myself familiar with the API changes so someone else should review it (but it's probably fine). ___ Python tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue3623> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2750] Add simplejson to Python 2.6/3.0 standard library
New submission from Bob Ippolito <[EMAIL PROTECTED]>: Attached is the tarball for simplejson 1.9, the proposed version to be included in the stdlib. Estimated work remaining: * Rename simplejson to json * Build simplejson/_speedups.c from Modules/Setup and Windows projects * Convert documentation to Python docs * Port to Python 3.0 -- components: Library (Lib) files: simplejson-1.9.tar.gz messages: 66176 nosy: bob.ippolito severity: normal status: open title: Add simplejson to Python 2.6/3.0 standard library type: feature request versions: Python 2.6, Python 3.0 Added file: http://bugs.python.org/file10185/simplejson-1.9.tar.gz __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue2750> __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2750] Add simplejson to Python 2.6/3.0 standard library
Bob Ippolito <[EMAIL PROTECTED]> added the comment: The json package is in brett's branch, integrates with the test suite, builds the C extension and passes all tests (at least on OS X and Linux UCS2 and UCS4). Missing the docs and python 3.0 support still, otherwise things look good. __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue2750> __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2750] Add simplejson to Python 2.6/3.0 standard library
Bob Ippolito <[EMAIL PROTECTED]> added the comment: It doesn't work on alternate implementations right now anyway, because it (ab)uses some sre APIs that aren't widely implemented outside of cpython. __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue2750> __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2750] Add simplejson to Python 2.6/3.0 standard library
Bob Ippolito <[EMAIL PROTECTED]> added the comment: it's isolated to json.scanner, if that was re-implemented in more general terms then it wouldn't be dependent on sre anymore. __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue2750> __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2750] Add simplejson to Python 2.6/3.0 standard library
Bob Ippolito <[EMAIL PROTECTED]> added the comment: Well, that's unfortunate. I found it very useful __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue2750> __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2750] Add simplejson to Python 2.6/3.0 standard library
Bob Ippolito <[EMAIL PROTECTED]> added the comment: They look good, but is there an easy way to look at them post-formatting or do I have to install the sphinx toolchain myself? I moved the command-line stuff to json.tool to get around the package problem. __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue2750> __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2750] Add simplejson to Python 2.6/3.0 standard library
Bob Ippolito <[EMAIL PROTECTED]> added the comment: I don't think that makes sense, "tool" makes it pretty clear that it's something you use from the command-line rather than a module to import and call functions from where pp does not. I'd also rather call it pprint than pp if that were the decision.. EIBTI. __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue2750> __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2750] Add simplejson to Python 2.6/3.0 standard library
Bob Ippolito <[EMAIL PROTECTED]> added the comment: loads will take unicode or str. if it's str then it assumes utf-8, otherwise the explicitly specified encoding. All of the string instances generated by loads will be unicode objects (some of them may be str objects if they're all ASCII as an optimization, I'm not sure if I implemented that or not). dumps produces an ASCII str, but if you explicitly specify ensure_ascii=False then it will return a unicode object. obviously load and dump will be working on a file-like object so should be dealing with bytes... I'm not entirely sure whether semantically dumps should produce bytes or str in py3k, I guess whatever the other text-based encodings do is appropriate (e.g. base64, mime). __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue2750> __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4136] merge json library with simplejson 2.0.3
New submission from Bob Ippolito <[EMAIL PROTECTED]>: simplejson 2.0.3 includes major performance enhancements (both in Python and C) and removes usage of the private sre functionality. I will need some help with 3.0 since I am not well versed in the changes to the C API or Python code for that, but merging for 2.6.1 should be no big deal. How should I go about this? -- assignee: bob.ippolito components: Library (Lib) messages: 74872 nosy: bob.ippolito severity: normal status: open title: merge json library with simplejson 2.0.3 versions: Python 2.6, Python 3.0 ___ Python tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue4136> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4136] merge json library with simplejson 2.0.3
Bob Ippolito <[EMAIL PROTECTED]> added the comment: Sure, but that doesn't port it to Python 3.0 :) ___ Python tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue4136> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4136] merge json library with simplejson 2.0.3
Bob Ippolito <[EMAIL PROTECTED]> added the comment: patch to r66961 of trunk is attached. -- keywords: +26backport, patch versions: +Python 2.7, Python 3.1 Added file: http://bugs.python.org/file11822/json_issue4136_r66961.diff ___ Python tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue4136> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4136] merge json library with simplejson 2.0.3
Bob Ippolito <[EMAIL PROTECTED]> added the comment: You're probably right, I don't remember what code I was using as a template for that. ___ Python tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue4136> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4136] merge json library with simplejson 2.0.3
Bob Ippolito <[EMAIL PROTECTED]> added the comment: Actually, if I remove those lines from the equivalent module in simplejson it no longer works properly with Python 2.5.2. File "/Users/bob/src/simplejson/simplejson/decoder.py", line 307, in __init__ self.scan_once = make_scanner(self) TypeError: cannot create 'make_scanner' instances ___ Python tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue4136> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4136] merge json library with simplejson 2.0.3
Bob Ippolito <[EMAIL PROTECTED]> added the comment: I don't recall exactly why they aren't in the struct itself, it may not have worked with some compiler on some platform. It's not really a complete rewrite, the encoding path is largely the same and the tests haven't changed. Anyway, there is no further work planned for simplejson. It's done except for the potential for bug fixes. The only enhancements were performance related and this is about as fast as it's going to get. The majority of this work was ready before Python 2.6 was released but it was frozen so I couldn't get this in. ___ Python tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue4136> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4136] merge json library with simplejson 2.0.3
Bob Ippolito <[EMAIL PROTECTED]> added the comment: http://codereview.appspot.com/7311 ___ Python tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue4136> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4136] merge json library with simplejson 2.0.3
Bob Ippolito <[EMAIL PROTECTED]> added the comment: Attached is a new diff, one byte fix to the float parser when parsing JSON documents that are just a float (also a test and a version bump). Added file: http://bugs.python.org/file11870/json_issue4136_r67009.diff ___ Python tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue4136> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4136] merge json library with simplejson 2.0.4
Changes by Bob Ippolito <[EMAIL PROTECTED]>: -- title: merge json library with simplejson 2.0.3 -> merge json library with simplejson 2.0.4 ___ Python tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue4136> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4783] json documentation needs a BAWM (Big A** Warning Message)
Bob Ippolito added the comment: You're the first person to ever raise any of these issues in the slightly more than 3 years that the package has been around (by other names), so I'm not sure such a warning needs to be that big. JSON doesn't really have any framing, so serializing more than one document to or from the same place doesn't work so well. It's not even talked about in the spec, and I've never seen someone try it before. -- priority: -> low ___ Python tracker <http://bugs.python.org/issue4783> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4783] json documentation needs a BAWM (Big A** Warning Message)
Bob Ippolito added the comment: Ok, I've added some notes to the trunk of simplejson's documentation. Not sure when/if that'll hit the Python trunks, I've been having a hard time getting my other patches to sync up with simplejson through: http://bugs.python.org/issue4136 ___ Python tracker <http://bugs.python.org/issue4783> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4782] json documentation missing load(), loads()
Bob Ippolito added the comment: There are some missing colons in the documentation apparently, which causes reStructuredText to ignore the documentation for those two functions. -- nosy: +bob.ippolito ___ Python tracker <http://bugs.python.org/issue4782> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4136] merge json library with simplejson 2.0.3
Bob Ippolito added the comment: By "next patch" I'm referring to a currently nonexistent patch that would merge the json library with simplejson 2.0.7 (svn trunk at the moment). I may have time to create it next weekend. --- http://codereview.appspot.com/7311/diff/1/8 File Lib/json/decoder.py (right): http://codereview.appspot.com/7311/diff/1/8#newcode55 Line 55: def py_scanstring(s, end, encoding=None, strict=True, _b=BACKSLASH, _m=STRINGCHUNK.match): Commented in the next patch. http://codereview.appspot.com/7311/diff/1/8#newcode71 Line 71: _append(content) Commented in the next patch http://codereview.appspot.com/7311/diff/1/8#newcode76 Line 76: msg = "Invalid control character {0!r} at".format(esc) This is a bug in the exception handling code, fixed in the next patch. http://codereview.appspot.com/7311/diff/1/8#newcode104 Line 104: raise ValueError Exception is caught at the except block and re-raised with a message. Next patch unrolls this so it's not confusing. http://codereview.appspot.com/7311/diff/1/8#newcode107 Line 107: raise ValueError Exception is caught at the except block and re-raised with a message. Next patch unrolls this so it's not confusing. http://codereview.appspot.com/7311/diff/1/8#newcode111 Line 111: m = unichr(uni) Renamed m to char in the next patch. http://codereview.appspot.com/7311/diff/1/8#newcode127 Line 127: nextchar = s[end:end + 1] commented in next patch (only once). s[end] can raise an IndexError with bad input, s[end:end+1] returns an empty string on underflow, which is caught later with a more helpful error message. http://codereview.appspot.com/7311/diff/1/8#newcode132 Line 132: nextchar = s[end:end + 1] commented in next patch (only once). s[end] can raise an IndexError with bad input, s[end:end+1] returns an empty string on underflow, which is caught later with a more helpful error message. http://codereview.appspot.com/7311/diff/1/8#newcode290 Line 290: following strings: -Infinity, Infinity, NaN. Not practically speaking. The documented purpose of this callback is "This can be used to raise an exception if invalid JSON numbers are encountered.". I've never seen it used to handle None, True, False in a different manner. That was more of an implementation detail than anything else, and that is fixed by this patch. Existing implementations of this callback will simply have dead code since they will never be called with "null", "true" or "false" anymore. http://codereview.appspot.com/7311/diff/1/8#newcode317 Line 317: def raw_decode(self, s, idx=0): It is a compatible change. http://codereview.appspot.com/7311/diff/1/9 File Modules/_json.c (right): http://codereview.appspot.com/7311/diff/1/9#newcode196 Line 196: output_size *= 2; _PyString_Resize checks for integer overflow, so it would explode there just fine. The next patch changes this slightly to avoid unnecessary calls to _PyString_Resize when the size didn't actually change, but doesn't do any explicit integer overflow checking http://codereview.appspot.com/7311/diff/1/9#newcode215 Line 215: ascii_escape_str(PyObject *pystr) Done in the next patch http://codereview.appspot.com/7311/diff/1/9#newcode733 Line 733: "..." Done in the next patch. http://codereview.appspot.com/7311/diff/1/9#newcode1320 Line 1320: if ((idx + 3 < length) && str[idx + 1] == 'u' && str[idx + 2] == 'l' && str[idx + 3] == 'l') { Probably not, but strncmp doesn't work for PyUnicode and the same code is repeated there. http://codereview.appspot.com/7311/diff/1/9#newcode1528 Line 1528: PyTypeObject PyScannerType = { I don't think it's possible to cause a cycle using the documented APIs, since the encoder is created and thrown away behind the scenes and never passed to user code. Someone else can write that patch if it's necessary. http://codereview.appspot.com/7311/diff/1/9#newcode2025 Line 2025: "make_encoder", /* tp_name */ It's not a type that's ever exposed to user code, make_encoder is somewhat less confusing because that's the name it's exposed as. I'll change it anyway though, it doesn't really matter since this is all private API. ___ Python tracker <http://bugs.python.org/issue4136> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4136] merge json library with latest simplejson 2.0.x
Bob Ippolito added the comment: patch to r69662 is attached as json_issue4136_r69662.diff -- note that simplejson 2.0.9 isn't released, as of r169 it's just simplejson 2.0.8 with some trivial changes to make this backport easier for me ___ Python tracker <http://bugs.python.org/issue4136> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4136] merge json library with latest simplejson 2.0.x
Changes by Bob Ippolito : Added file: http://bugs.python.org/file13106/json_issue4136_r69662.diff ___ Python tracker <http://bugs.python.org/issue4136> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4136] merge json library with latest simplejson 2.0.x
Bob Ippolito added the comment: Old-style relative imports and the way that it does join are there because it's Python 2.4 compatible code that I'm porting. I'll add those to the list of things that need to be changed when backporting, implement cyclic GC on the types, and I'll take a look at lines > 80 chars and fix any that occur in Python code (though for some of the tests it may be a bit more effort than its worth). It will probably take another week or two for me to implement those things and then do another backport. ___ Python tracker <http://bugs.python.org/issue4136> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue34858] MappingProxy objects should JSON serialize just like a dictionary
Bob Ippolito added the comment: I would certainly reconsider it at this point, I think a bona fide ABC *specific to JSON encoding* would be a good way to do it. simplejson has two ways to do this, the `for_json` parameter which will use a `for_json()` method on any object as the JSON representation if present, and the `namedtuple_as_object` parameter which will do the same for objects with an `_asdict()` method. As part of the standard library it might make more sense to rename `for_json()` to `__json__()` or similar. It is a bit unfortunate that you can't guarantee round-trip on deserialization, but that has always been the case. To get round-tripping (without tagging everything that has been encoded in some way like pickle does), you really should be working with a schema of some kind. -- ___ Python tracker <https://bugs.python.org/issue34858> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue29636] Specifying indent in the json.tool command
Bob Ippolito added the comment: Probably the best thing we could do here is to mirror the options available in similar tools, such as jq: https://stedolan.github.io/jq/manual/#Invokingjq The relevant options here would be: --indent --tab --compact-output --sort-keys The default indent in jq is 2, which I tend to prefer these days, but maybe 4 is still appropriate given PEP 8: $ echo '[{}, {"a": "b"}, 2, 3, 4]' | jq [ {}, { "a": "b" }, 2, 3, 4 ] This is how jq interprets --compact-output: $ echo '[{}, {"a": "b"}, 2, 3, 4]' | jq --compact-output [{},{"a":"b"},2,3,4] I do not think that it's worth having the command-line tool cater to people that want to indent in other ways (e.g. using a string that isn't all spaces or a single tab). -- ___ Python tracker <http://bugs.python.org/issue29636> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue29863] Add a COMPACT constant to the json module
Bob Ippolito added the comment: I suppose I'm +0. I don't think this is particularly useful, but this is closer to the ideal of just having a boolean option. We should probably also plan to remove the documentation for what the type of separators is to give the impression that COMPACT and the default are the only valid options. -- ___ Python tracker <http://bugs.python.org/issue29863> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue29992] Expose parse_string in JSONDecoder
Bob Ippolito added the comment: I agree with that sentiment. If we were to want to support this use case I would rather put together a coherent way to augment the parsing/encoding of anything than bolt it on to what we have. -- ___ Python tracker <http://bugs.python.org/issue29992> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue30114] json module: it is not possible to override 'true', 'false' values during encoding bool
Bob Ippolito added the comment: Agreed, this does seem unnecessary. The library has been in active use for over a decade, and this is the first time I've seen this request. I would recommend preprocessing the data that you're going to encode if you have a need for this. -- stage: -> resolved status: open -> closed ___ Python tracker <http://bugs.python.org/issue30114> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue29992] Expose parse_string in JSONDecoder
Bob Ippolito added the comment: That's not a very convincing argument. Python 2 only returns byte strings if the input is a byte string and the contents of the string are all ASCII. Facilitating that sort of behavior in 3 would probably cause more issues than it solves. -- ___ Python tracker <http://bugs.python.org/issue29992> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue29992] Expose parse_string in JSONDecoder
Bob Ippolito added the comment: Generally speaking, parsing some things as decimal or datetime are schema dependent. It's unlikely that you would want to parse every string that looks enough like a decimal as a decimal, or that you would want to pay the cost of checking every string in the whole document to see if it's a decimal. This use case is probably better served using something like object_pairs_hook where you have some context available. Ultimate flexibility is not the goal of this interface. It's grown a bit too much of that over time. At this point I'm a lot more interested in proposals that remove options rather than add them. In order to provide maximal flexibility it would be much nicer to have a streaming interface available (like SAX for XML parsing), but that is not what this is. -- ___ Python tracker <https://bugs.python.org/issue29992> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue34529] add the option for json.dumps to return newline delimited json
Bob Ippolito added the comment: I think the best start would be to add a bit of documentation with an example of how you could work with newline delimited json using the existing module as-is. On the encoding side you need to ensure that it's a compact representation without embedded newlines, e.g.: for obj in objs: yield json.dumps(obj, separators=(',', ':')) + '\n' I don't think it would make sense to support this directly from dumps, as it's really multiple documents rather than the single document that every other form of dumps will output. On the read side it would be something like: for doc in lines: yield json.loads(doc) I'm not sure if this is common enough (and separable enough from I/O and error handling constraints) to be worth adding the functionality directly into json module. I think it would be more appropriate in the short to medium term that the each service (e.g. BigQuery) would have its own module with helper functions or framework that encapsulates the protocol that the particular service speaks. -- ___ Python tracker <https://bugs.python.org/issue34529> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue34529] add the option for json.dumps to return newline delimited json
Bob Ippolito added the comment: I suggested that each module would likely implement its own functions tailored to that project's IO and error handling requirements. The implementation may differ slightly depending on the protocol. This is consistent with how JSON is typically dealt with from a web framework, for example. -- ___ Python tracker <https://bugs.python.org/issue34529> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue35005] argparse should accept json and yaml argument types
Bob Ippolito added the comment: I don't think that this has anything in particular to do with the json module, at least it certainly shouldn't need any additional functionality from there. YAML parsing isn't available in the stdlib last I checked, so that is probably not really up for consideration for direct integration. In any case, I think the best approach would be to first do some research (StackOverflow, GitHub, etc.) to see how other folks are doing this in the wild, to see if there's a common pattern that should be made available in the stdlib. -- ___ Python tracker <https://bugs.python.org/issue35005> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue35111] Make Custom Object Classes JSON Serializable
Bob Ippolito added the comment: The trouble with having such a hook is that it would take precedence over any customization you might want or need to do to satisfy the protocol you're implementing. Other than the limited set of types that are part of the JSON specification, there's essentially no standard for encoding of anything else. This is why customization is left to the call sites for encoding and decoding, and I would recommend using the `default` and `object_pairs_hook` keyword arguments to `dumps` and `loads` respectively for that, rather than any of the options that you've enumerated. For what it's worth, simplejson has had a `for_json` method hook for several years to encourage some consolidation, but it's opt-in and there hasn't been a lot of demand to make it the default. The inverse `from_json` type operation is not supported. If you think about it, how *could* you even implement such a thing in the general case, in a way that wouldn't have lots of surprises and performance issues? -- ___ Python tracker <https://bugs.python.org/issue35111> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue35111] Make Custom Object Classes JSON Serializable
Bob Ippolito added the comment: That's what the for_json method is in simplejson, it does not have widespread usage. You can implement that when encoding: ``` def json_default(obj): try: return obj.__json__() except AttributeError: raise TypeError("{} can not be JSON encoded".format(type(obj))) json.dumps(foo(), default=json_default) ``` This way, you can choose precisely how the output needs to work when encoding. It's not ideal for every use case, but nothing is. The point is that it doesn't get in your way, whatever you need to do can be done without any awful tricks, so long as you have control over the dumps call site. -- ___ Python tracker <https://bugs.python.org/issue35111> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18726] json functions have too many positional parameters
Bob Ippolito added the comment: I tend to agree with Raymond here. While I also don't like the positional arguments, I don't think the benefit of API churn them is high enough to remove them. Other than this issue, I have not seen any requests for this change. I have seen problems because there are positional arguments, but only when people are subclassing these classes. Allowing for subclasses was never a good idea, and is actively discouraged in current simplejson documentation. The dumps default/loads object_hook functionality is sufficient and doesn't have the fragile base class problem. This functionality is is fully compatible with all versions of the library that are in use, back to v1.8 in March 2008, including Python 2.6's json library which IIRC is based on v1.9. -- assignee: bob.ippolito -> rhettinger ___ Python tracker <http://bugs.python.org/issue18726> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18726] json functions have too many positional parameters
Bob Ippolito added the comment: Other than when subclassing (which is actively discouraged), I haven't seen anyone try and use positional args for these APIs. I simply don't think this is an issue in practice. If you go far enough back in simplejson history, these module-global functions were actually keyword-only. -- ___ Python tracker <http://bugs.python.org/issue18726> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18726] json functions have too many positional parameters
Bob Ippolito added the comment: My evidence is only anecdotal. I haven't actively searched for code that uses json/simplejson to try and find cases that are using positional arguments. One way to test this assumption would be to release a version of simplejson that deprecates using positional arguments and see if anyone notices. If you feel strongly about it, submit a pull request, and I'll review it (although my availability is spotty for the next two months due to travel). -- ___ Python tracker <http://bugs.python.org/issue18726> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15252] Delivery reports about your e-mail
Bob Ippolito added the comment: I doubt it, it's more likely that this email came from somewhere else with my address. On Thursday, July 5, 2012, Larry Hastings wrote: > > Larry Hastings > added the comment: > > What fresh hell is this? Bob, do you have a virus or something? > > -- > nosy: +larry > > ___ > Python tracker > > <http://bugs.python.org/issue15252> > ___ > -- ___ Python tracker <http://bugs.python.org/issue15252> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19361] Specialize exceptions thrown by JSON parser
Bob Ippolito added the comment: simplejson v3.5.1 is probably a good target, let me know if there's anything that you'd like me to merge back in from stdlib to make maintenance easier. I haven't been tracking stdlib except when I've been added to issues. -- ___ Python tracker <http://bugs.python.org/issue19361> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21213] Memory bomb by incorrect custom serializer to json.dumps
Bob Ippolito added the comment: I agree with ebfe. It's a case that only comes up if you're writing your own default handlers, and there's not a reasonable solution to avoid this issue. You would've gotten a "RuntimeError: maximum recursion depth exceeded" if it wasn't for the behavior of repr here. -- ___ Python tracker <http://bugs.python.org/issue21213> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13212] json library is decoding/encoding when it should not
Bob Ippolito added the comment: As Chris Rebert mentioned, the JSON standards have adopted this (unsurprising) behavior. Ruby hasn't, and I doubt Crockford has, but I think they're in the minority at this point. JavaScript's own JSON implementation works the same way json/simplejson does. > JSON.parse(JSON.stringify('yay')) "yay" At best, I think it's probably worth a mention in the documentation, but not worth changing any code over. -- ___ Python tracker <http://bugs.python.org/issue13212> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13212] json library is decoding/encoding when it should not
Bob Ippolito added the comment: In other words, I would consider this to be fixed by the documentation change made elsewhere. -- ___ Python tracker <http://bugs.python.org/issue13212> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11844] Update json to upstream simplejson latest release
Bob Ippolito added the comment: To try and make this as painless as possible I have done both things. simplejson is now explicitly dual-licensed MIT or AFL v2.1 and there is also an explicit sentence in LICENSE.txt that states "This code is also licensed to the Python Software Foundation (PSF) under a Contributor Agreement." simplejson v3.0.7 (tag v3.0.7 in the repo) is this version. If there's anything more I can do to help, please let me know. -- status: pending -> open ___ Python tracker <http://bugs.python.org/issue11844> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21514] update json module docs in light of RFC 7159 & ECMA-404
Bob Ippolito added the comment: This patch looks reasonable to me as-is. With regard to "Infinite and NaN number values are accepted and output;" there's an option for that (allow_nan=False in encoding, parse_constant=some_function_that_raises in decoding). Since an exception can't be raised in a lambda there's no simple one-liner to ensure compliant decode. -- ___ Python tracker <http://bugs.python.org/issue21514> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21514] update json module docs in light of RFC 7159 & ECMA-404
Bob Ippolito added the comment: Good call, I was just doing a quick review of the patch in isolation. Now I don't have anything at all to comment on :) -- ___ Python tracker <http://bugs.python.org/issue21514> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21514] update json module docs in light of RFC 7159 & ECMA-404
Changes by Bob Ippolito : -- assignee: bob.ippolito -> rhettinger ___ Python tracker <http://bugs.python.org/issue21514> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6566] json.dumps converts None to "null" (not null)
Bob Ippolito added the comment: JP is correct, this is how JSON works. The behavior of coercing keys to strings is often desirable, although I agree it could be confusing if you aren't familiar with the JSON spec. -- components: +Documentation -Library (Lib) ___ Python tracker <http://bugs.python.org/issue6566> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6594] json C serializer performance tied to structure depth on some systems
Bob Ippolito added the comment: Did you try the trunk of simplejson? It doesn't work quite the same way as the current json module in Python 2.6+. Without the data or a tool to produce data that causes the problem, there isn't much I can do to help. -- ___ Python tracker <http://bugs.python.org/issue6594> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7444] Allow for a default method in the JSON decoder
Bob Ippolito added the comment: If it had JavaScript style Date objects in it, it wasn't a JSON document. While it may be easy enough to do this in the version that happens to be included with Python, the optimizations in later versions of simplejson make this no longer possible. You'd have to change a bunch of C and Python code to parse that. There are fewer function calls and regular expressions for efficiency reasons. It's not simplejson's goal to be able to parse non-JSON documents. -- resolution: -> wont fix ___ Python tracker <http://bugs.python.org/issue7444> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7444] Allow for a default method in the JSON decoder
Changes by Bob Ippolito : -- status: open -> closed ___ Python tracker <http://bugs.python.org/issue7444> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7451] improve json decoding performance
Bob Ippolito added the comment: I applied most of this patch to r206 of simplejson trunk -- ___ Python tracker <http://bugs.python.org/issue7451> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4136] merge json library with latest simplejson 2.0.x
Bob Ippolito added the comment: New patch implementing cyclic GC, new-style relative imports, no lines >80 characters in non-test Python code Added file: http://bugs.python.org/file13152/json_issue4136_r69885.diff ___ Python tracker <http://bugs.python.org/issue4136> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue5381] json need object_pairs_hook
Bob Ippolito added the comment: Why? According to RFC (emphasis mine): An object is an *unordered* collection of zero or more name/value pairs, where a name is a string and a value is a string, number, boolean, null, object, or array. -- resolution: -> invalid ___ Python tracker <http://bugs.python.org/issue5381> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue5381] json need object_pairs_hook
Bob Ippolito added the comment: Fair enough, but the patch isn't usable because the decoder was rewritten in a later version of simplejson. There's another issue with patch to backport those back into Python http://bugs.python.org/issue4136 or you could just use the simplejson source here http://code.google.com/p/simplejson/ -- resolution: invalid -> ___ Python tracker <http://bugs.python.org/issue5381> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4136] merge json library with latest simplejson 2.0.x
Bob Ippolito added the comment: Honestly I'm not sure when I'm going to find the time and motivation to reformat the C source and tests to fit < 80 char lines. I don't think this should hold up the patch, someone who is more obsessive compulsive than myself can fix that once it hits trunk :) ___ Python tracker <http://bugs.python.org/issue4136> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4136] merge json library with latest simplejson 2.0.x
Bob Ippolito added the comment: They are essentially the same except the relative imports are changed to use . syntax, simplejson._speedups is changed to _json, simplejson is changed to json, .format strings are used, and the test suite changes slightly. I can add fixing that struct function and removing the #if stuff from the C code to that list as well. The way I see it, the names have to change anyway, so other things might as well be modernized as long as it's trivial. I personally didn't make the call to switch from % to .format, someone else did that after I had originally committed simplejson to Python 2.6 trunk. ___ Python tracker <http://bugs.python.org/issue4136> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue5067] Error msg from using wrong quotes in JSON is unhelpful
Bob Ippolito added the comment: I don't really want to see looser input requirements, making a JSON parser that is compatible with a subset of Python repr output isn't a design goal of mine. This is absolutely false: "Because single quotes are the only way (AFAIK) in which Python's repr() produces invalid JSON (from JSONable combinations of types)." >>> repr(object) "" If you don't know JSON, I'm not sure throwing random input at the JSON parser is going to help you. Is that how you learned XML? There's plenty of info in the JSON documentation and a link to json.org if you need help. ___ Python tracker <http://bugs.python.org/issue5067> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue5067] Error msg from using wrong quotes in JSON is unhelpful
Bob Ippolito added the comment: Er, sorry, missed "(from JSONable combinations of types)". It's early. Anyway, I can change the error message, but I will not make it special- case single quotes for its own error message. I will have to think about what the message could say instead. Note that the same sort of person who throws random input at parsers might even expect {test: 'test'} to work since that is valid JavaScript but not valid JSON. ___ Python tracker <http://bugs.python.org/issue5067> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue5381] json need object_pairs_hook
Bob Ippolito added the comment: Unfortunately this is a patch for the old json lib... the new one has a C API and an entirely different method of parsing documents (for performance reasons). ___ Python tracker <http://bugs.python.org/issue5381> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue5381] json need object_pairs_hook
Bob Ippolito added the comment: Whenever someone applies the patch for http://bugs.python.org/issue4136 -- I don't know when that will happen. ___ Python tracker <http://bugs.python.org/issue5381> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4136] merge json library with latest simplejson 2.0.x
Bob Ippolito added the comment: All of the comments are addressed. I am not going to go through the trouble of creating a new patch to remove the remaining backwards compatibility cruft in the C code and struct function. That is easier to remove later. -- ___ Python tracker <http://bugs.python.org/issue4136> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4136] merge json library with latest simplejson 2.0.x
Bob Ippolito added the comment: r70443 in trunk -- status: open -> closed ___ Python tracker <http://bugs.python.org/issue4136> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue5381] json needs object_pairs_hook
Bob Ippolito added the comment: This patch looks good to me, my only comment is that the patch mixes tabs and spaces in the C code in a file that had no tabs previously -- ___ Python tracker <http://bugs.python.org/issue5381> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue5535] json custom encoder not fully functionnal
Bob Ippolito added the comment: It is common to specify a default function but it would be terrible for performance if this function was called for every single object passed through to the decoder. If you want a serialization different from a primitive type you'll have to choose a different base class. -- resolution: -> wont fix ___ Python tracker <http://bugs.python.org/issue5535> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue5535] json custom encoder not fully functionnal
Bob Ippolito added the comment: The documentation says "If specified, default is a function that gets called for objects that can’t otherwise be serialized. It should return a JSON encodable version of the object or raise a TypeError." *can't otherwise be serialized* means that the object must not be a subtype of something that is serializable. The implementation is correct and this behavior is documented. Documentation patches to make this more obvious are acceptable, but it's not a bug so it can't be fixed as such. -- ___ Python tracker <http://bugs.python.org/issue5535> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue5584] json.loads(u'3.14') fails unexpectedly (minor scanner bug)
New submission from Bob Ippolito : http://code.google.com/p/simplejson/issues/detail?id=43 Need a <= where there's a < in the unicode float scanner. problem only exists when decoding a unicode float that is not in any sort of container (e.g. array or object). -- assignee: bob.ippolito keywords: easy messages: 84299 nosy: bob.ippolito severity: normal stage: needs patch status: open title: json.loads(u'3.14') fails unexpectedly (minor scanner bug) type: behavior versions: Python 2.7, Python 3.1 ___ Python tracker <http://bugs.python.org/issue5584> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue5584] json.loads(u'3.14') fails unexpectedly (minor scanner bug)
Changes by Bob Ippolito : -- components: +Library (Lib) ___ Python tracker <http://bugs.python.org/issue5584> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue5584] json.loads(u'3.14') fails unexpectedly (minor scanner bug)
Changes by Bob Ippolito : -- resolution: -> accepted ___ Python tracker <http://bugs.python.org/issue5584> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue5584] json.loads(u'3.14') fails unexpectedly (minor scanner bug)
Bob Ippolito added the comment: trunk fix for 2.7 is in r70702 -- unsure about how to port this to 3.1 -- ___ Python tracker <http://bugs.python.org/issue5584> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue5381] json needs object_pairs_hook
Bob Ippolito added the comment: I fixed two problems with this that didn't show up in the test suite, this feature didn't work in load() and there was a problem with the pure python code path because the Python scanner needed a small change. Unfortunately I'm not sure how to best test the pure python code path with Python's test suite, but I ran across it when backporting to simplejson. r70702 -- ___ Python tracker <http://bugs.python.org/issue5381> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue5723] Incomplete json tests
Bob Ippolito added the comment: Is this high priority? The pure-Python code paths don't even run in cpython. I test them manually with simplejson by just deleting the extension and then running the tests again. There doesn't seem to be a very good way to do this sort of thing -- ___ Python tracker <http://bugs.python.org/issue5723> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue5723] Incomplete json tests
Bob Ippolito added the comment: I don't think the decorator approach would work for the doctests, it looks like it could be an interesting approach though. I have a feeling that it's going to have to be done in some kind of ugly subclass though, I'll dig into unittest deeper this weekend to see how that might be done. -- ___ Python tracker <http://bugs.python.org/issue5723> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1530559] struct.pack raises TypeError where it used to convert
Bob Ippolito added the comment: I believe that struct.error is just how it worked before 2.5 -- ___ Python tracker <http://bugs.python.org/issue1530559> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1496032] test_float segfaults with SIGFPE on FreeBSD 6.0 / Alpha
Bob Ippolito added the comment: I don't even recall where I had access to a FreeBSD 6.0 Alpha machine, sorry. -- ___ Python tracker <http://bugs.python.org/issue1496032> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue5729] Allows tabs for indenting JSON output
Bob Ippolito added the comment: Well this feature is already in simplejson 2.1.0, it would probably make more sense to simply merge the latest simplejson back with Python 3. -- ___ Python tracker <http://bugs.python.org/issue5729> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue29540] Add compact=True flag to json.dump/dumps
Bob Ippolito added the comment: I agree, in isolation it's a fine proposal, but the interface here is already a bit too complex and the benefit is pretty minimal. When the size really does matter, you can take care to set it correctly once and be done with it. -- ___ Python tracker <http://bugs.python.org/issue29540> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue29540] Add compact=True flag to json.dump/dumps
Bob Ippolito added the comment: I would recommend a moratorium on new options until we have a plan to make the usage of the JSON APIs simpler overall. It's accumulated too many options over time. The real trouble is figuring out how to do this in a backwards compatible way that does not impact performance too much. Off-hand, I can't think of any obvious way aside from using new function names with a cleaner options list. -- ___ Python tracker <http://bugs.python.org/issue29540> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17225] JSON decoder reports wrong column number on first line
Bob Ippolito added the comment: I've applied a very similar patch to simplejson and released 3.0.9 https://github.com/simplejson/simplejson/commit/44d7709a31f3a19f3d465411585ebb7be7fa2295 -- nosy: +bob.ippolito ___ Python tracker <http://bugs.python.org/issue17225> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17906] JSON should accept lone surrogates
Bob Ippolito added the comment: The patch that I wrote for simplejson is here (it differs a bit from serhiy's patch): https://github.com/simplejson/simplejson/commit/35816bfe2d0ddeb5ddcc68239683cbb35b7e3ff2 I discovered another bug along the way in the pure-Python scanstring, int(s, 16) will parse '0xNN' when json expects only strings of the form '' to work. I fixed that along with this issue by explicitly checking for x or X. -- ___ Python tracker <http://bugs.python.org/issue17906> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue23123] Only READ support for Decimal in json
Bob Ippolito added the comment: simplejson has had a use_decimal flag for output since 2.1.0 and has been enabled by default since 2.2.0. simplejson 3.2.0 introduced a for_json argument that checks objects for a method of that name for serialization. https://github.com/simplejson/simplejson/blob/master/CHANGES.txt -- ___ Python tracker <http://bugs.python.org/issue23123> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue23123] Only READ support for Decimal in json
Bob Ippolito added the comment: I'm sure there's some hack that would allow you to preserve the input. I would try using parse_float and have it return some object that preserves the string and will be output in precisely the same way. It may need to be a Decimal subclass. I'm traveling for the next few weeks so I won't have much of a chance to investigate myself. -- ___ Python tracker <http://bugs.python.org/issue23123> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue23123] Only READ support for Decimal in json
Bob Ippolito added the comment: Subclass Decimal and implement __str__ to return your own representation. Use parse_float to use your Decimal subclass. Should work with simplejson, a similar hack may be possible with the json module. -- ___ Python tracker <http://bugs.python.org/issue23123> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue23123] Only READ support for Decimal in json
Bob Ippolito added the comment: I don't think it's reasonable to expect Decimal to always output precisely the same string it was given. It's a waste of complexity and space and the only time you would want this behavior is when you really should've left it accessible as a string in the first place. It sounds like the spec for that signature may be poorly designed (with regard to portability). Relying on the precise string output of a number is not going to work in any JSON parser I've ever seen. You'd need to work at the tokenizer level and not all of the parsers provide an interface at that layer (since many of them combine tokenization and parsing). -- ___ Python tracker <http://bugs.python.org/issue23123> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue23123] Only READ support for Decimal in json
Bob Ippolito added the comment: Yeah, that's the hack I was suggesting. I suppose I don't see the point of having a protocol that normalizes *almost* everything. Normalization should be all or nothing. Other options would be to define the signature at the encoded byte level with no normalization (in which case you could use any off the shelf signing), or at the value level and prescribe a specific interpretation for data types. I would've done it at the value level and prescribed that dictionaries should be key sorted, strings dealt with as UTF-8, and numbers as IEEE 754. I would make sure not to depend on the decimal conversion of numbers, and just work with the serialized bit representation in a particular endian (which you can even do efficiently in modern browser JS with Float64Array, DataView and ArrayBuffer). For JS portability it'd probably treat *all* numbers as floats in the same way, whether they had a decimal to begin with or not. -- ___ Python tracker <http://bugs.python.org/issue23123> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24518] json.dumps should accept key function for ``sort_keys``
Bob Ippolito added the comment: Seems like a good idea to me, I'll make sure this gets in simplejson as well. -- ___ Python tracker <http://bugs.python.org/issue24518> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24518] json.dumps should accept key function for ``sort_keys``
Bob Ippolito added the comment: On further investigation, simplejson has implemented this functionality under a different name since 2.5.0 (2012-03-29). """ If item_sort_key is a callable (not the default), then the output of dictionaries will be sorted with it. The callable will be used like this: sorted(dct.items(), key=item_sort_key). This option takes precedence over sort_keys. Changed in version 2.5.0: item_sort_key is new in 2.5.0. """ -- ___ Python tracker <http://bugs.python.org/issue24518> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com