Changes between Version 1 and Version 2 of Ticket #35618, comment 1


Ignore:
Timestamp:
Jul 18, 2024, 5:30:21 PM (5 months ago)
Author:
Simon Charette

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #35618, comment 1

    v1 v2  
    44
    55I guess that we could possibly make `request.close` idempotent given what's returned by `test.Client` should already be closed?
     6
     7{{{#!diff
     8diff --git a/django/http/response.py b/django/http/response.py
     9index 0d756403db..65dfe3a786 100644
     10--- a/django/http/response.py
     11+++ b/django/http/response.py
     12@@ -324,6 +324,8 @@ def make_bytes(self, value):
     13     # The WSGI server must call this method upon completion of the request.
     14     # See http://blog.dscpl.com.au/2012/10/obligations-for-calling-close-on.html
     15     def close(self):
     16+        if self.closed:
     17+            return
     18         for closer in self._resource_closers:
     19             try:
     20                 closer()
     21}}}
Back to Top