Skip to content

fix(container): align sequence equality and contains#560

Merged
junrushao merged 1 commit intoapache:mainfrom
junrushao:split/container-semantics
Apr 21, 2026
Merged

fix(container): align sequence equality and contains#560
junrushao merged 1 commit intoapache:mainfrom
junrushao:split/container-semantics

Conversation

@junrushao
Copy link
Copy Markdown
Member

No description provided.

@junrushao junrushao marked this pull request as ready for review April 20, 2026 06:57
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request enhances FFI containers, specifically Array and List, by enabling structural equality and containment checks against standard Python sequences like lists and tuples. It introduces helper functions _sequence_compare_other and _sequence_contains to facilitate these comparisons. The review feedback suggests improving the robustness of _sequence_compare_other by handling potential conversion errors, optimizing _sequence_contains to prevent redundant allocations when searching for nested sequences, and reducing code duplication in __ne__ methods by delegating to __eq__.

Comment thread python/tvm_ffi/container.py
Comment thread python/tvm_ffi/container.py
Comment thread python/tvm_ffi/container.py Outdated
Comment thread python/tvm_ffi/container.py Outdated
@junrushao junrushao force-pushed the split/container-semantics branch from 3f3a1aa to 3730d25 Compare April 21, 2026 06:03
@junrushao junrushao merged commit 09e7216 into apache:main Apr 21, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants