Skip to content

Commit b3f1341

Browse files
committed
prevent infinite loop when faulty kwarg cannot be removed
1 parent 7a7996a commit b3f1341

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

waveform_editor/tendencies/base.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ def _setup_param(self, kwargs):
235235
except ValueError as error:
236236
# Fetch error and add to annotations
237237
error_msg = str(error)
238-
match = re.search(r"'(\w+\.user_\w+)'", error_msg)
238+
match = re.search(r"'(\w+\.\w+)'", error_msg)
239239
param_to_remove = match.group(1)
240240
param_to_remove_no_class = param_to_remove.split(".")[1]
241241
cleaned_error_msg = error_msg.replace(
@@ -248,7 +248,10 @@ def _setup_param(self, kwargs):
248248
is_warning=True,
249249
)
250250
# Ignore keyword argument with ValueError
251-
del kwargs[param_to_remove_no_class]
251+
if param_to_remove_no_class in kwargs:
252+
kwargs.pop(param_to_remove_no_class)
253+
else:
254+
return
252255

253256
# Recursively retry with new kwargs
254257
self._setup_param(kwargs)

0 commit comments

Comments
 (0)