From fc28c536ffd6497a197fd8fd2441600c0de321d6 Mon Sep 17 00:00:00 2001 From: Laurent Peuch Date: Tue, 22 Jun 2021 04:26:34 +0200 Subject: [PATCH] [fix] can't modify a dict size on iteration in python3 --- src/yunohost/app.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/yunohost/app.py b/src/yunohost/app.py index 13ac3bbb0..ef5de554b 100644 --- a/src/yunohost/app.py +++ b/src/yunohost/app.py @@ -153,13 +153,18 @@ def app_search(string): # Retrieve a simple dict listing all apps catalog_of_apps = app_catalog() + to_delete = [] + # Selecting apps according to a match in app name or description for app in catalog_of_apps["apps"].items(): if not ( re.search(string, app[0], flags=re.IGNORECASE) or re.search(string, app[1]["description"], flags=re.IGNORECASE) ): - del catalog_of_apps["apps"][app[0]] + to_delete.append(app[0]) + + for app in to_delete: + del catalog_of_apps["apps"][app] return catalog_of_apps