-
Notifications
You must be signed in to change notification settings - Fork 199
Open
Description
Running some tests of my code with Python 3.14.0 (on Linux) I spotted this:
/usr/lib/python3.14/site-packages/sshtunnel.py:1040: SyntaxWarning: 'return' in a 'finally' block
Looking at the code the finally seems a bit pointless as several exceptions are being caught. The trouble with this approach is that other exceptions are simply lost, i.e. if the code raises something other than IOError, AttributeError or TypeError those exceptions would not be reported or raised As an example consider this:
`def foo():
try:
raise Exception("test")
finally:
return "hello"
print(foo())`
This prints "hello", there is nothing to indicate the Exception happened
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels