Skip to content

concrete_descendents clobbers descendents #651

@sdrobert

Description

@sdrobert

ALL software version info

param v1.12.2, Colab notebook

Description of expected behavior and the observed behavior

Simply put, classes with the same name get clobbered in get_concrete_descendents().

I came across this bug when trying to run some unit tests with duplicated code (and class definitions) were in different files.

Complete, minimal, self-contained example code that reproduces the issue

import sys
import param

from param.parameterized import descendents

print(param.__version__)

class A(object):
  pass

class B(A):
  pass

b = B

print(b in param.concrete_descendents(A).values())

class B(A):
  pass

print(b in param.concrete_descendents(A).values(), b in descendents(A))
print(B in param.concrete_descendents(A).values(), B in descendents(A))
print(issubclass(b, A), issubclass(b, A))

Colab

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions