mirror of
https://github.com/beetbox/beets.git
synced 2025-12-14 20:43:41 +01:00
Fix #3041: only try to close opened archives
The "finally" clause here only wants to apply when `archive` is assigned. Otherwise, we were getting a NameError trying to refer to the appropriate variable.
This commit is contained in:
parent
6a92fa8b70
commit
3b78d933cf
2 changed files with 4 additions and 2 deletions
|
|
@ -1059,9 +1059,9 @@ class ArchiveImportTask(SentinelImportTask):
|
|||
if path_test(util.py3_path(self.toppath)):
|
||||
break
|
||||
|
||||
extract_to = mkdtemp()
|
||||
archive = handler_class(util.py3_path(self.toppath), mode='r')
|
||||
try:
|
||||
extract_to = mkdtemp()
|
||||
archive = handler_class(util.py3_path(self.toppath), mode='r')
|
||||
archive.extractall(extract_to)
|
||||
finally:
|
||||
archive.close()
|
||||
|
|
|
|||
|
|
@ -86,6 +86,8 @@ Fixes:
|
|||
* Fix a problem when resizing images with PIL/Pillow on Python 3.
|
||||
Thanks to :user:`architek`.
|
||||
:bug:`2504` :bug:`3029`
|
||||
* Avoid a crash when archive extraction fails during import.
|
||||
:bug:`3041`
|
||||
|
||||
.. _python-itunes: https://github.com/ocelma/python-itunes
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue