fix(connectivity): Use list instead of set for Net objects#187
Open
shanemmattner wants to merge 1 commit into
Open
fix(connectivity): Use list instead of set for Net objects#187shanemmattner wants to merge 1 commit into
shanemmattner wants to merge 1 commit into
Conversation
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 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
TypeError: unhashable type: 'Net'inConnectivityAnalyzer._add_wire_to_net()existing_netsfromset()tolist()sinceNetobjects are mutable and should not be hashableProblem
When analyzing schematics with multiple wires connecting to the same pins, the connectivity analyzer crashed:
Netis a mutable dataclass (hasmerge(),add_pin()methods) and correctly does not define__hash__. But the code tried to add Net objects to a Python set.Solution
Use a list with membership check instead:
Test plan
🤖 Generated with Claude Code