#33755: Move ASGi body-file cleanup into ASGIRequest ------------------------------------------------+------------------------ Reporter: Carlton Gibson | Owner: nobody Type: Cleanup/optimization | Status: new Component: HTTP handling | Version: dev Severity: Normal | Keywords: ASGI Triage Stage: Unreviewed | Has patch: 0 Needs documentation: 0 | Needs tests: 0 Patch needs improvement: 0 | Easy pickings: 0 UI/UX: 0 | ------------------------------------------------+------------------------ In `django/core/handlers/asgi.py` `ASGIHandler.handle()` currently creates a temporary file, `body_file`, and then maintains responsibility for closing that once the response is generated in an extend `try...finally`. In outline:
``` body_file = ... try: ... finally: body_file.close() ``` The `body_file` is passed into the request, via `create_request()` and `ASGIRequest.__init()`. Conceptually the request object takes ownership of `body_file` at that point, and ideally it would be responsible for cleaning it up too, perhaps via a `__del__` implementation. -- Ticket URL: <https://code.djangoproject.com/ticket/33755> Django <https://code.djangoproject.com/> The Web framework for perfectionists with deadlines. -- You received this message because you are subscribed to the Google Groups "Django updates" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-updates+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/0107018118edbb9d-d439ede1-7cfa-4f67-82bd-30e4752369c6-000000%40eu-central-1.amazonses.com.