itej13 opened a new pull request, #69084: URL: https://github.com/apache/airflow/pull/69084
`S3Hook.download_file` opened a local file (or a `NamedTemporaryFile` with `delete=False`), streamed the object into it, and returned the path **without ever closing the handle** — relying on garbage collection to release the descriptor. On a download error the handle leaked the same way. Closing it in a `finally` releases the descriptor on every path (success and failure) while keeping the downloaded file on disk for the caller. Adds a regression test asserting the handle is closed when the download raises. related: #69077 --- ##### Was generative AI tooling used to co-author this PR? - [X] Yes — Claude Code (Opus 4.8) Generated-by: Claude Code (Opus 4.8) following [the guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
