fix: avoid mutating list while iterating over it (#24438)
This commit is contained in:
parent
f36a753c5a
commit
ee6743c26b
5 changed files with 5 additions and 5 deletions
|
|
@ -601,7 +601,7 @@ def console(context, autoreload=False):
|
|||
all_apps = frappe.get_installed_apps()
|
||||
failed_to_import = []
|
||||
|
||||
for app in all_apps:
|
||||
for app in list(all_apps):
|
||||
try:
|
||||
locals()[app] = __import__(app)
|
||||
except ModuleNotFoundError:
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@ class Comment(Document):
|
|||
|
||||
def remove_comment_from_cache(self):
|
||||
_comments = get_comments_from_parent(self)
|
||||
for c in _comments:
|
||||
for c in list(_comments):
|
||||
if c.get("name") == self.name:
|
||||
_comments.remove(c)
|
||||
|
||||
|
|
|
|||
|
|
@ -271,7 +271,7 @@ def set_desktop_icons(visible_list, ignore_duplicate=True):
|
|||
frappe.db.sql("update `tabDesktop Icon` set blocked=0, hidden=1 where standard=1")
|
||||
|
||||
# set as visible if present, or add icon
|
||||
for module_name in visible_list:
|
||||
for module_name in list(visible_list):
|
||||
name = frappe.db.get_value("Desktop Icon", {"module_name": module_name})
|
||||
if name:
|
||||
frappe.db.set_value("Desktop Icon", name, "hidden", 0)
|
||||
|
|
|
|||
|
|
@ -238,7 +238,7 @@ def update_column_order(board_name, order):
|
|||
new_columns = []
|
||||
|
||||
for col in order:
|
||||
for column in old_columns:
|
||||
for column in list(old_columns):
|
||||
if col == column.column_name:
|
||||
new_columns.append(column)
|
||||
old_columns.remove(column)
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ def report_error(status_code):
|
|||
|
||||
|
||||
def _link_error_with_message_log(error_log, exception, message_logs):
|
||||
for message in message_logs:
|
||||
for message in list(message_logs):
|
||||
if message.get("__frappe_exc_id") == getattr(exception, "__frappe_exc_id", None):
|
||||
error_log.update(message)
|
||||
message_logs.remove(message)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue