From 745767bcceabcd8a08207dd9550cbf877018300b Mon Sep 17 00:00:00 2001 From: Laurent Monin Date: Fri, 24 May 2024 12:15:24 +0200 Subject: [PATCH] cluster()/_do_clustering(): pass files as tuple instead of list - the sequence isn't modified anywhere between cluster() and _clustering_finished() (that loops over it) --- picard/tagger.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/picard/tagger.py b/picard/tagger.py index 21646fdba..078c0ca89 100644 --- a/picard/tagger.py +++ b/picard/tagger.py @@ -1281,15 +1281,15 @@ class Tagger(QtWidgets.QApplication): def cluster(self, objs, callback=None): """Group files with similar metadata to 'clusters'.""" log.debug("Clustering %r", objs) - files = iter_files_from_objects(objs) + files = tuple(iter_files_from_objects(objs)) thread.run_task( - partial(self._do_clustering, list(files)), + partial(self._do_clustering, files), partial(self._clustering_finished, callback)) def _do_clustering(self, files): # The clustering algorithm should completely run in the thread, # hence do not return the iterator. - return list(Cluster.cluster(files)) + return tuple(Cluster.cluster(files)) def _clustering_finished(self, callback, result=None, error=None): if error: