[issue14573] json iterencode can not handle general iterators

2018-04-14 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: It is included. -- ___ Python tracker ___

[issue14573] json iterencode can not handle general iterators

2018-04-14 Thread Alfred Morgan
Alfred Morgan added the comment: @serhiy.storchaka while you are doing your overhaul will you please add support for raw json values. I often find myself where I have a serialized object that I want to include in an object response that I'm about to serialize anyway. The

[issue14573] json iterencode can not handle general iterators

2018-04-13 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Things are more complicated. bytes object is an iterable. I think serialize an bytes object (which can be unexpectedly leaked in a code ported from 2.7) as a list of integers is not expected behavior in most cases. It is safer

[issue14573] json iterencode can not handle general iterators

2018-04-13 Thread Alfred Morgan
Alfred Morgan added the comment: I would love to but it is a bit late for me now. The json encoding has been optimized in c which falls outside my expertise. https://github.com/python/cpython/blob/master/Modules/_json.c -- ___ Python

[issue14573] json iterencode can not handle general iterators

2018-04-12 Thread Ned Deily
Ned Deily added the comment: If there is still interest in this, perhaps @Zectbumo could rebase the patch as a PR against the master branch of the current python/cpython repo now that we've moved to git and GitHub (https://devguide.python.org/pullrequest/). There's no

[issue14573] json iterencode can not handle general iterators

2018-04-12 Thread Jan Vlcinsky
Jan Vlcinsky added the comment: I found proposed change very handy (came here researching why it is not behaving that way). Taking into account: - Python shines in handling lists, using generators and iterators - Largest group of python developers develop web

[issue14573] json iterencode can not handle general iterators

2014-10-02 Thread Alfred Morgan
Alfred Morgan added the comment: Need a patch? Here you go. https://github.com/Zectbumo/cpython/compare/master How to use it: encoder = JSONEncoder(stream=True) This will iterencode() iterators as lists and file objects as strings and stream them when constructed with stream=True.

[issue14573] json iterencode can not handle general iterators

2012-04-20 Thread Éric Araujo
Éric Araujo mer...@netwok.org added the comment: Agreed with Antoine; I think that if this is added, it should be opt-in, not default. Also, it is not clear if the request is about iterators or iterables. -- nosy: +eric.araujo ___ Python tracker

[issue14573] json iterencode can not handle general iterators

2012-04-15 Thread Antoine Pitrou
Antoine Pitrou pit...@free.fr added the comment: That's more of a feature request than a bug. By definition JSON can only represent a small subset of Python's types. Also, if you encode an iterator as a JSON list, you will get back a Python list when decoding the JSON representation, so it

[issue14573] json iterencode can not handle general iterators

2012-04-13 Thread Aaron Staley
New submission from Aaron Staley usaa...@gmail.com: The json library's encoder includes a function called 'iterencode'. iterencode allows for encoding to be streamed; as tokens are produced they are yielded. This allows for the encoded object to be streamed to a file, over a socket, etc.

[issue14573] json iterencode can not handle general iterators

2012-04-13 Thread Ezio Melotti
Changes by Ezio Melotti ezio.melo...@gmail.com: -- nosy: +ezio.melotti, rhettinger stage: - test needed type: - behavior versions: +Python 3.3 -Python 2.6, Python 3.1 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14573