Fix possible use of unassigned local variable in git_cl.py
When an exception occurs in CheckCallAndFilter the push_returncode variable is used in the finally block without being initialized. Traceback (most recent call last): File "C:\Google\depot_tools\metrics.py", line 266, in print_notice_and_exit yield File "C:\Google\depot_tools\git_cl.py", line 5647, in <module> sys.exit(main(sys.argv[1:])) File "C:\Google\depot_tools\git_cl.py", line 5629, in main return dispatcher.execute(OptionParser(), argv) File "C:\Google\depot_tools\subcommand.py", line 252, in execute return command(parser, args[1:]) File "C:\Google\depot_tools\git_cl.py", line 4641, in CMDupload return cl.CMDUpload(options, args, orig_args) File "C:\Google\depot_tools\git_cl.py", line 1623, in CMDUpload ret = self.CMDUploadChange(options, git_diff_args, custom_cl_base, change) File "C:\Google\depot_tools\git_cl.py", line 2746, in CMDUploadChange 'exit_code': push_returncode, UnboundLocalError: local variable 'push_returncode' referenced before assignment Change-Id: Ife0e5226aa7e6127e8a508adb747f2c653ed8351 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1536033Reviewed-by: Dirk Pranke <dpranke@chromium.org> Commit-Queue: Raul Tambre <raul@tambre.ee>
Showing
Please
register
or
sign in
to comment