Repository navigation
JSONEncoder's tolist() branch hangs and exhausts memory when a mock reaches a response, instead of raising TypeError #10076
Unanswered
Macavirus
asked this question in
Potential Issue
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
This is a follow-up to #7546, which was closed as an unactionable edge case. I hit this while running some tests, memory exploded and my machine ground to a halt.
The stdlib json encoder raises TypeError here. DRF's default() sees tolist, calls it, gets another Mock, and repeats forever.
Happens here: https://github.com/encode/django-rest-framework/blob/main/rest_framework/utils/encoders.py#L61-L63
All reactions