[issue35901] json.dumps infinite recurssion

2021-09-07 Thread Irit Katriel
Change by Irit Katriel : -- resolution: -> not a bug stage: -> resolved status: open -> closed ___ Python tracker ___ ___ Python-b

[issue35901] json.dumps infinite recurssion

2019-02-05 Thread MultiSosnooley
MultiSosnooley added the comment: Oh, I got it. Size is too high growing to reach recurtion limit. I replace repr with slow growing data and now there is good old recursion limit exception. import json class F: counter = 0 total = 0 data = b"" def __call__(self, o):

[issue35901] json.dumps infinite recurssion

2019-02-05 Thread Karthikeyan Singaravelan
Karthikeyan Singaravelan added the comment: I guess json module expects a return value from default function that is str, int, float, etc. that can be handled by built in encoders and returning a bytes object with repr causes it to keep calling default until a value of one of expected type i

[issue35901] json.dumps infinite recurssion

2019-02-05 Thread MultiSosnooley
New submission from MultiSosnooley : ``` __import__('json').dumps(object(), default=lambda o: repr(o).encode()) ``` Produce infinite recursion on `default` function. Here is more informative example: ``` >>> def f(o): ... input(f"{o!r} {type(o)}") ... return repr(o).encode() ... >>> im