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

saaj report at bugs.python.org
Sat Apr 26 20:41:07 CEST 2014


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 restricted to given types (what the encoder is capable on its own), it is harder to shoot oneself in the foot. 

In other words what's the point of returning arbitrary Python object from the function?

----------

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


More information about the Python-bugs-list mailing list