Skip to content

Copy protocol broken: deepcopy of any live descriptor raises; copy of any EasyList raises #271

Open

Description

@rozyczko

Findings V-H3, V-H2, G-M3 in DEEP_ANALYSIS.md (parent #261).

  1. DescriptorBase inherits SerializerComponent.__deepcopy__ (io/serializer_component.py:28-29), which does self.from_dict(self.as_dict()) without skipping unique_name; reconstruction collides in the global map (map.py:166-167 raises ValueError: Object name ... already exists). So copy.deepcopy(param) always fails while copy.copy(param) works (__copy__ correctly skips unique_name). NewBase patched this for itself; DescriptorBase did not.
  2. EasyList.to_dict() (easy_list.py:359) overrides NewBase.to_dict(skip=...) with an incompatible signature (Liskov violation); NewBase.__copy__ calls self.to_dict(skip=['unique_name']) -> TypeError for every EasyList.
  3. __deepcopy__ also ignores memo, so shared children are duplicated instead of shared (broken deepcopy semantics for diamond graphs).

Fix: implement __deepcopy__ at the hierarchy root with skip=['unique_name'] + memo support; align EasyList.to_dict signature. Add copy/deepcopy round-trip tests for every descriptor and collection type.

Activity

  1. added
    [scope] bug
    [priority] high
    [area] base classes
    on Jun 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    [area] base classes[priority] high[scope] bug

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions