diff --git a/beets/mediafile.py b/beets/mediafile.py index 13f1b2dfb..bd9b11969 100644 --- a/beets/mediafile.py +++ b/beets/mediafile.py @@ -1317,7 +1317,7 @@ class DateField(MediaField): for item in items: try: items_.append(int(item)) - except: + except (TypeError, ValueError): items_.append(None) return items_ diff --git a/beets/plugins.py b/beets/plugins.py index 2ecdb8472..d62f3c011 100644 --- a/beets/plugins.py +++ b/beets/plugins.py @@ -264,7 +264,7 @@ def load_plugins(names=()): and obj != BeetsPlugin and obj not in _classes: _classes.add(obj) - except: + except Exception: log.warning( u'** error loading plugin {}:\n{}', name, diff --git a/beets/util/functemplate.py b/beets/util/functemplate.py index 51716552c..58b0416a1 100644 --- a/beets/util/functemplate.py +++ b/beets/util/functemplate.py @@ -570,7 +570,7 @@ class Template(object): """ try: res = self.compiled(values, functions) - except: # Handle any exceptions thrown by compiled version. + except Exception: # Handle any exceptions thrown by compiled version. res = self.interpret(values, functions) return res diff --git a/beets/util/pipeline.py b/beets/util/pipeline.py index 367e5d980..39bc7152e 100644 --- a/beets/util/pipeline.py +++ b/beets/util/pipeline.py @@ -270,7 +270,7 @@ class FirstPipelineThread(PipelineThread): return self.out_queue.put(msg) - except: + except BaseException: self.abort_all(sys.exc_info()) return @@ -318,7 +318,7 @@ class MiddlePipelineThread(PipelineThread): return self.out_queue.put(msg) - except: + except BaseException: self.abort_all(sys.exc_info()) return @@ -357,7 +357,7 @@ class LastPipelineThread(PipelineThread): # Send to consumer. self.coro.send(msg) - except: + except BaseException: self.abort_all(sys.exc_info()) return @@ -425,7 +425,7 @@ class Pipeline(object): while threads[-1].is_alive(): threads[-1].join(1) - except: + except BaseException: # Stop all the threads immediately. for thread in threads: thread.abort() diff --git a/beetsplug/duplicates.py b/beetsplug/duplicates.py index 93d53c58a..2f6bba3e6 100644 --- a/beetsplug/duplicates.py +++ b/beetsplug/duplicates.py @@ -185,7 +185,7 @@ class DuplicatesPlugin(BeetsPlugin): if tag: try: k, v = tag.split('=') - except: + except Exception: raise UserError( u"{}: can't parse k=v tag: {}".format(PLUGIN, tag) ) diff --git a/beetsplug/thumbnails.py b/beetsplug/thumbnails.py index 838206156..04845e880 100644 --- a/beetsplug/thumbnails.py +++ b/beetsplug/thumbnails.py @@ -274,8 +274,6 @@ class GioURI(URIGetter): try: uri_ptr = self.libgio.g_file_get_uri(g_file_ptr) - except: - raise finally: self.libgio.g_object_unref(g_file_ptr) if not uri_ptr: @@ -285,8 +283,6 @@ class GioURI(URIGetter): try: uri = copy_c_string(uri_ptr) - except: - raise finally: self.libgio.g_free(uri_ptr)