RecursionError on deepcopy of Request #8682
Unanswered
mlegner
asked this question in
Potential Issue
Replies: 1 comment 3 replies
-
Okay - I don't quite understand that, but must be something to do with the implementation details of (Ie. at some point we've got a new I guess a test case and a fix would probably be okay here. What's the use-case for |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I noticed that calling
deepcopy
on aRequest
object causes infinite recursion with aRecursionError
.Minimal working example:
This produces the following output:
The problem seems to be the custom
__getattr__
function defined in rest_framework/request.py#L410-L418:For some reason, there is a
Request
instance without_request
attribute, so that theself._request
in this function causes another call to__getattr__
. A possible fix that works for me (and is otherwise equal to the current implementation) is the following:I would be happy to convert this to an issue and/or create a PR with this change.
My program versions:
Beta Was this translation helpful? Give feedback.
All reactions