After returning a dict of data from a route, I ran into RecursionError: maximum recursion depth exceeded in comparison from abc.py and it took me a long time to figure out why: I was returning a datetime.datetime as part of the data, which is not JSON serializable by default.
Turns out, because the default method used for JSON serialization returns a TypeError instead of raising it, the default method gets called with a TypeError over and over again, recursively, eventually hiding the original exception entirely.
I don't know if there was any reason to return the TypeError instead of raising it, but it's clearly not working as intended.
After returning a dict of data from a route, I ran into
RecursionError: maximum recursion depth exceeded in comparison
fromabc.py
and it took me a long time to figure out why: I was returning adatetime.datetime
as part of the data, which is not JSON serializable by default.Turns out, because the
default
method used for JSON serialization returns a TypeError instead of raising it, thedefault
method gets called with a TypeError over and over again, recursively, eventually hiding the original exception entirely.I don't know if there was any reason to return the TypeError instead of raising it, but it's clearly not working as intended.
The
return
has been present since https://github.com/encode/apistar/pull/400.