Closed iritkatriel closed 3 weeks ago
NA
master branch
Avoid return in finally.
In https://github.com/espressif/esptool/blob/8298cdcc68a8063df1ca932d42e21555e15269b3/esptool/cmds.py#L158 there is a return statement in a finally block, which would swallow any in-flight exception.
return
finally
This means that if an unhandled exception (including a BaseException such as KeyboardInterrupt) is raised from the try body, or any exception is raised from an except: clause, it will not propagate on as expected.
BaseException
KeyboardInterrupt
try
except:
See also https://docs.python.org/3/tutorial/errors.html#defining-clean-up-actions.
No response
Hello @iritkatriel and thank you for reporting this! We will look into this and fix it.
Operating System
NA
Esptool Version
master branch
Python Version
NA
Full Esptool Command Line that Was Run
NA
Esptool Output
What is the Expected Behaviour?
Avoid return in finally.
More Information
In https://github.com/espressif/esptool/blob/8298cdcc68a8063df1ca932d42e21555e15269b3/esptool/cmds.py#L158 there is a
return
statement in afinally
block, which would swallow any in-flight exception.This means that if an unhandled exception (including a
BaseException
such asKeyboardInterrupt
) is raised from thetry
body, or any exception is raised from anexcept:
clause, it will not propagate on as expected.See also https://docs.python.org/3/tutorial/errors.html#defining-clean-up-actions.
Other Steps to Reproduce
No response