Skip to content

gh-143831: Compare cells by identity in forward references#143848

Merged
JelleZijlstra merged 14 commits intopython:mainfrom
johnslavik:fix-forwardrefs-dont-hash-cells
Jan 19, 2026
Merged

gh-143831: Compare cells by identity in forward references#143848
JelleZijlstra merged 14 commits intopython:mainfrom
johnslavik:fix-forwardrefs-dont-hash-cells

Conversation

@johnslavik
Copy link
Member

@johnslavik johnslavik commented Jan 14, 2026

Cells are mutable and, in regular comparison, they are equal when their contents are equal (or if both are empty).

Two different cells should not be considered equal by value in forward references, though.
If there are two separate cells, they either (1) target different variables or (2) belong to different scopes, so two separate forward references storing two separate cells are conceptually unequal even if these cells happen to be equal at a given point in time. Mutability, essentially.

I'm still working on tests.

Loading
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.

5 participants