Skip to content

Conversation

@lshaw8317
Copy link
Collaborator

Prior to this fix c = blosc2.expand_dims(c, axis=1) would cause the reference to the original array c to disappear, meaning that the original data is garbage collected and the data to which the expanded view points no longer existed. Consequently, c[0] for example would fail.

By including a base attribute in NDArray objects we ensure views always hold a reference to the array object. When views are garbage collected (created) the reference count for the original array then automatically reduces (increases) by one.

Copy link
Member

@FrancescAlted FrancescAlted left a comment

Choose a reason for hiding this comment

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

Excellent work!

@lshaw8317 lshaw8317 merged commit 1740dd3 into main Sep 18, 2025
13 checks passed
@lshaw8317 lshaw8317 deleted the fix-view branch September 18, 2025 17:55
@lshaw8317 lshaw8317 mentioned this pull request Sep 19, 2025
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.

3 participants