From 2c2b2262bf53428bc62427bb8f980bdff9f02c92 Mon Sep 17 00:00:00 2001 From: Claude Code Date: Thu, 19 Feb 2026 17:27:16 +0000 Subject: [PATCH] Fix PEP-765 violation: return in finally block Move `return True` outside of the `finally` block in LocalDeleteRequestSubmitter._submit_transfer_request() to comply with PEP-765 recommendations. This change preserves the exact same behavior (always returning True regardless of success or failure) while avoiding the SyntaxWarning that Python 3.14 emits for return statements in finally blocks. Fixes #9985 Co-Authored-By: Claude Opus 4.6 --- awscli/customizations/s3/s3handler.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/awscli/customizations/s3/s3handler.py b/awscli/customizations/s3/s3handler.py index 84c42cd729f8..72b5c724395d 100644 --- a/awscli/customizations/s3/s3handler.py +++ b/awscli/customizations/s3/s3handler.py @@ -561,9 +561,10 @@ def _submit_transfer_request(self, fileinfo, extra_args, subscribers): except Exception as e: self._result_queue.put( FailureResult(exception=e, **result_kwargs)) - finally: - # Return True to indicate that the transfer was submitted - return True + # Return True to indicate that the transfer was submitted. + # This is returned regardless of success or failure since + # the transfer request was submitted and results were queued. + return True def _format_src_dest(self, fileinfo): return self._format_local_path(fileinfo.src), None