holoviz / param

Param: Make your Python code clearer and more reliable by declaring Parameters
https://param.holoviz.org
BSD 3-Clause "New" or "Revised" License
412 stars 69 forks source link

Fix regression in ListSelector with `check_on_set=False` #874

Closed maximlt closed 8 months ago

maximlt commented 9 months ago

Fixes https://github.com/holoviz/param/issues/872

I also found a pretty bad bug in _instantiate_param_obj where we were looping only through the __slots__ defined on the Parameter class, ignoring the ones it inherits. Easy mistake, kls.__slots__ should really return all the slots! This bug led ListSelector._objects being shared between a Parameterized class and instance, since the _objects slot is declared in a parent class.

-    for s in p.__class__.__slots__:
+    for s in p.__class__._all_slots_:
        v = getattr(p, s)
        if _is_mutable_container(v) and s != "default":
            setattr(p, s, copy.copy(v))

I also made sure that setting None with check_on_set=False and allow_None=True doesn't add None to the objects.

maximlt commented 8 months ago

Merging to prepare a new release candidate.