itej13 opened a new pull request, #69083: URL: https://github.com/apache/airflow/pull/69083
`FTPHook.retrieve_file` and `FTPHook.store_file` opened a local file and then ran the FTP transfer before calling `close()`. If the transfer raised — a routine occurrence for network I/O — the handle was never closed and leaked for the lifetime of the process. Wrapping the transfer in `try/finally` guarantees the handle we opened is always closed, while still leaving a caller-supplied file-like buffer open (the method's existing contract). Adds regression tests for both methods that fail without the fix. closes: #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]
