In ExtractSublimePackage.py (lines ~57-61):
try:
arc = zipfile.ZipFile(filename)
except zipfile.BadZipfile:
# can't open the file
_msg("package file %s is invalid" % base_name)
with contextlib.closing(arc):
After a BadZipfile the message is shown but execution continues into with contextlib.closing(arc): where arc was never assigned, so the command raises UnboundLocalError: local variable 'arc' referenced before assignment (in addition to the message). The original intent is clearly "report and stop".
Fix: add return after the _msg(...) call.
Found while testing packages from the Package Control catalog (source review).
In
ExtractSublimePackage.py(lines ~57-61):After a
BadZipfilethe message is shown but execution continues intowith contextlib.closing(arc):wherearcwas never assigned, so the command raisesUnboundLocalError: local variable 'arc' referenced before assignment(in addition to the message). The original intent is clearly "report and stop".Fix: add
returnafter the_msg(...)call.Found while testing packages from the Package Control catalog (source review).