mirror of
				https://github.com/encode/django-rest-framework.git
				synced 2025-11-04 09:57:55 +03:00 
			
		
		
		
	Fix infinite recursion with deepcopy on Request (#8684)
This commit is contained in:
		
							parent
							
								
									c10f226622
								
							
						
					
					
						commit
						d507cd851c
					
				| 
						 | 
					@ -413,7 +413,8 @@ class Request:
 | 
				
			||||||
        to proxy it to the underlying HttpRequest object.
 | 
					        to proxy it to the underlying HttpRequest object.
 | 
				
			||||||
        """
 | 
					        """
 | 
				
			||||||
        try:
 | 
					        try:
 | 
				
			||||||
            return getattr(self._request, attr)
 | 
					            _request = self.__getattribute__("_request")
 | 
				
			||||||
 | 
					            return getattr(_request, attr)
 | 
				
			||||||
        except AttributeError:
 | 
					        except AttributeError:
 | 
				
			||||||
            return self.__getattribute__(attr)
 | 
					            return self.__getattribute__(attr)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,6 +1,7 @@
 | 
				
			||||||
"""
 | 
					"""
 | 
				
			||||||
Tests for content parsing, and form-overloaded content parsing.
 | 
					Tests for content parsing, and form-overloaded content parsing.
 | 
				
			||||||
"""
 | 
					"""
 | 
				
			||||||
 | 
					import copy
 | 
				
			||||||
import os.path
 | 
					import os.path
 | 
				
			||||||
import tempfile
 | 
					import tempfile
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -344,3 +345,10 @@ class TestHttpRequest(TestCase):
 | 
				
			||||||
        # ensure that request stream was consumed by form parser
 | 
					        # ensure that request stream was consumed by form parser
 | 
				
			||||||
        assert request.content_type.startswith('multipart/form-data')
 | 
					        assert request.content_type.startswith('multipart/form-data')
 | 
				
			||||||
        assert response.data == {'a': ['b']}
 | 
					        assert response.data == {'a': ['b']}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					class TestDeepcopy(TestCase):
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    def test_deepcopy_works(self):
 | 
				
			||||||
 | 
					        request = Request(factory.get('/', secure=False))
 | 
				
			||||||
 | 
					        copy.deepcopy(request)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user