[issue21213] Memory bomb by incorrect custom serializer to json.dumps

2014-06-29 Thread Ezio Melotti
Changes by Ezio Melotti : -- stage: -> resolved ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.p

[issue21213] Memory bomb by incorrect custom serializer to json.dumps

2014-05-22 Thread Raymond Hettinger
Changes by Raymond Hettinger : -- resolution: -> not a bug status: open -> closed ___ Python tracker ___ ___ Python-bugs-list mailing

[issue21213] Memory bomb by incorrect custom serializer to json.dumps

2014-05-22 Thread Bob Ippolito
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

[issue21213] Memory bomb by incorrect custom serializer to json.dumps

2014-05-22 Thread Raymond Hettinger
Changes by Raymond Hettinger : -- nosy: +bob.ippolito ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://m

[issue21213] Memory bomb by incorrect custom serializer to json.dumps

2014-04-26 Thread saaj
saaj added the comment: I'll try to be more specific at my point. There're two cases: 1. Scalar: NoneType, int, bool, float, str. Ended immediately. 2. Non-scalar: list/tuple, dict. Recursively traversed, which may result in subsequent calls to the custom function. If the return value is r

[issue21213] Memory bomb by incorrect custom serializer to json.dumps

2014-04-26 Thread Lukas Lueg
Lukas Lueg added the comment: It's perfectly fine for the function to return an object that can't be put directly into a json string. The function may not convert the object directly but in multiple steps; the encoder will call the function again with the new object until everything boils down

[issue21213] Memory bomb by incorrect custom serializer to json.dumps

2014-04-26 Thread saaj
saaj added the comment: Well, as far as I see the question here is whether it makes sense to allow the default function to return JSON-incompatible objects. -- ___ Python tracker __

[issue21213] Memory bomb by incorrect custom serializer to json.dumps

2014-04-26 Thread Lukas Lueg
Lukas Lueg added the comment: The behavior is triggered in Modules/_json.c:encoder_listencode_obj(). It actually has nothing to do with the TypeError itself, any object that produces a new string representation of itself will do. The function encoder_listencode_obj() calls the user-supplied fu

[issue21213] Memory bomb by incorrect custom serializer to json.dumps

2014-04-20 Thread Ezio Melotti
Changes by Ezio Melotti : -- nosy: +ezio.melotti, pitrou, rhettinger type: -> behavior versions: +Python 3.4, Python 3.5 -Python 3.3 ___ Python tracker ___ _

[issue21213] Memory bomb by incorrect custom serializer to json.dumps

2014-04-14 Thread saaj
New submission from saaj: I was chaning an implementation of the function that is passed to json.dumps to extend serializable types. By a mistake (**return** instead of **raise**) it turned into, which at its minum can be expressed as:: def d(obj): return TypeError(repr(obj)) json.dum