Skip to content

Commit fc488fa

Browse files
committed
Catch SyntaxError when parsing kwargs
1 parent e2b3c5a commit fc488fa

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

crystal_toolkit/core/mpcomponent.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -519,6 +519,7 @@ def get_slider_input(
519519
):
520520

521521
state = state or {}
522+
# TODO: bug if default == 0
522523
default = default or state.get(kwarg_label)
523524

524525
# mpc.RangeSlider requires a domain to be specified
@@ -745,7 +746,7 @@ def reconstruct_kwargs_from_state(self, state=None, kwarg_labels=None) -> dict:
745746

746747
try:
747748
kwargs[kwarg_label] = literal_eval(str(v))
748-
except ValueError:
749+
except (ValueError, SyntaxError):
749750
kwargs[kwarg_label] = str(v)
750751

751752
elif k_type == "bool":

0 commit comments

Comments
 (0)