Skip to content

Commit 489ca7c

Browse files
committed
Maintain traitlets 4 vs 5 spec consistent
1 parent a451a50 commit 489ca7c

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

ipywidgets/widgets/widget_link.py

+6
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,12 @@ class WidgetTraitTuple(Tuple):
1919

2020
def __init__(self, **kwargs):
2121
super().__init__(Instance(Widget), Unicode(), **kwargs)
22+
if "default_value" not in kwargs and not kwargs.get("allow_none", False):
23+
# This is to keep consistent behavior for spec generation between traitlets 4 and 5
24+
# Having a default empty container is explicitly not allowed in traitlets 5 when
25+
# there are traits specified (as the default value will be invalid), but we do it
26+
# anyway as there is no empty "default" that makes sense.
27+
self.default_args = ()
2228

2329
def validate_elements(self, obj, value):
2430
value = super().validate_elements(obj, value)

0 commit comments

Comments
 (0)