From 702595feab412be5d0488a575310abb7eab212fd Mon Sep 17 00:00:00 2001 From: Shane Mattner Date: Sat, 29 Nov 2025 01:12:57 -0600 Subject: [PATCH] fix(connectivity): Use list instead of set for Net objects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Net objects are mutable (they have merge() and add_pin() methods) and should not be hashable. Changed existing_nets from set() to list() in _add_wire_to_net() to fix TypeError: unhashable type: 'Net'. The bug occurred when analyzing schematics with multiple wires connecting to the same pins, causing the analyzer to try adding Net objects to a set. Fixes connectivity analysis for complex schematics like the Motor Driver schematic (101 nets, 113 components). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- kicad_sch_api/core/connectivity.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/kicad_sch_api/core/connectivity.py b/kicad_sch_api/core/connectivity.py index f16ecf9..b7cc105 100644 --- a/kicad_sch_api/core/connectivity.py +++ b/kicad_sch_api/core/connectivity.py @@ -242,10 +242,13 @@ def _add_wire_to_net(self, wire: Wire, pins: Set[PinConnection], wire_points: Li wire_points: Points along the wire """ # Check if any of these pins are already in a net - existing_nets = set() + # Use list instead of set since Net objects are mutable (not hashable) + existing_nets = [] for pin in pins: if pin in self._pin_to_net: - existing_nets.add(self._pin_to_net[pin]) + net = self._pin_to_net[pin] + if net not in existing_nets: + existing_nets.append(net) if existing_nets: # Merge all existing nets into the first one