-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Closed
Labels
bugThis issue is a bug.This issue is a bug.p3This is a minor priority issueThis is a minor priority issue
Description
Describe the bug
The codebase contains instances of return (possibly also break, or continue) statements directly within a finally block, which trigger a SyntaxWarning in Python 3.14 per PEP-765.
Example of the issue:
aws-cli/awscli/customizations/s3/s3handler.py
Lines 564 to 566 in 46a50f1
| finally: | |
| # Return True to indicate that the transfer was submitted | |
| return True |
Regression Issue
- Select this option if this issue appears to be a regression.
Expected Behavior
We should omit using return, continue, and break inside finally clause.
Current Behavior
We have instances of return (and maybe continue, and break) inside finally clause.
Reproduction Steps
$ python --version
Python 3.14.2
$ python -m venv .venv
$ source .venv/bin/activate
(.venv) $ pip install awscli
Collecting awscli
Using cached awscli-1.44.17-py3-none-any.whl.metadata (11 kB)
Collecting botocore==1.42.27 (from awscli)
Using cached botocore-1.42.27-py3-none-any.whl.metadata (5.9 kB)
Collecting docutils<=0.19,>=0.18.1 (from awscli)
Using cached docutils-0.19-py3-none-any.whl.metadata (2.7 kB)
Collecting s3transfer<0.17.0,>=0.16.0 (from awscli)
Using cached s3transfer-0.16.0-py3-none-any.whl.metadata (1.7 kB)
Collecting PyYAML<6.1,>=3.10 (from awscli)
Using cached pyyaml-6.0.3-cp314-cp314-macosx_10_13_x86_64.whl.metadata (2.4 kB)
Collecting colorama<0.4.7,>=0.2.5 (from awscli)
Using cached colorama-0.4.6-py2.py3-none-any.whl.metadata (17 kB)
Collecting rsa<4.8,>=3.1.2 (from awscli)
Using cached rsa-4.7.2-py3-none-any.whl.metadata (3.6 kB)
Collecting jmespath<2.0.0,>=0.7.1 (from botocore==1.42.27->awscli)
Using cached jmespath-1.0.1-py3-none-any.whl.metadata (7.6 kB)
Collecting python-dateutil<3.0.0,>=2.1 (from botocore==1.42.27->awscli)
Using cached python_dateutil-2.9.0.post0-py2.py3-none-any.whl.metadata (8.4 kB)
Collecting urllib3!=2.2.0,<3,>=1.25.4 (from botocore==1.42.27->awscli)
Using cached urllib3-2.6.3-py3-none-any.whl.metadata (6.9 kB)
Collecting six>=1.5 (from python-dateutil<3.0.0,>=2.1->botocore==1.42.27->awscli)
Using cached six-1.17.0-py2.py3-none-any.whl.metadata (1.7 kB)
Collecting pyasn1>=0.1.3 (from rsa<4.8,>=3.1.2->awscli)
Using cached pyasn1-0.6.1-py3-none-any.whl.metadata (8.4 kB)
Using cached awscli-1.44.17-py3-none-any.whl (4.6 MB)
Using cached botocore-1.42.27-py3-none-any.whl (14.6 MB)
Using cached colorama-0.4.6-py2.py3-none-any.whl (25 kB)
Using cached docutils-0.19-py3-none-any.whl (570 kB)
Using cached jmespath-1.0.1-py3-none-any.whl (20 kB)
Using cached python_dateutil-2.9.0.post0-py2.py3-none-any.whl (229 kB)
Using cached pyyaml-6.0.3-cp314-cp314-macosx_10_13_x86_64.whl (181 kB)
Using cached rsa-4.7.2-py3-none-any.whl (34 kB)
Using cached s3transfer-0.16.0-py3-none-any.whl (86 kB)
Using cached urllib3-2.6.3-py3-none-any.whl (131 kB)
Using cached pyasn1-0.6.1-py3-none-any.whl (83 kB)
Using cached six-1.17.0-py2.py3-none-any.whl (11 kB)
Installing collected packages: urllib3, six, PyYAML, pyasn1, jmespath, docutils, colorama, rsa, python-dateutil, botocore, s3transfer, awscli
Successfully installed PyYAML-6.0.3 awscli-1.44.17 botocore-1.42.27 colorama-0.4.6 docutils-0.19 jmespath-1.0.1 pyasn1-0.6.1 python-dateutil-2.9.0.post0 rsa-4.7.2 s3transfer-0.16.0 six-1.17.0 urllib3-2.6.3
$ rm -rf .venv/lib/python3.14/site-packages/awscli/customizations/s3/__pycache__
$ python
>>> import warnings
... warnings.filterwarnings("always", category=SyntaxWarning)
>>> from awscli.customizations.s3.s3handler import LocalDeleteRequestSubmitter
/private/tmp/.venv/lib/python3.14/site-packages/awscli/customizations/s3/s3handler.py:566: SyntaxWarning: 'return' in a 'finally' block
return True
Possible Solution
No response
Additional Information/Context
No response
CLI version used
1.44.17
Environment details (OS name and version, etc.)
MacOS, Linux
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugThis issue is a bug.This issue is a bug.p3This is a minor priority issueThis is a minor priority issue