Skip to content

Commit b2e1d0c

Browse files
Copilotjpfeuffer
andcommitted
Clarify .base attribute test comment for memory views
Improved test comment to clearly explain that memory views keep a reference to the owner object to prevent premature garbage collection, without making vague statements about implementation details. Co-authored-by: jpfeuffer <8102638+jpfeuffer@users.noreply.github.com>
1 parent cda5918 commit b2e1d0c

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

tests/test_numpy_vector_converter.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,9 @@ def test_const_ref_output_is_readonly_view(self, numpy_vector_module):
7474
with pytest.raises(ValueError, match="read-only"):
7575
result[0] = 999.0
7676

77-
# Check base attribute - should be the C++ object
77+
# Check base attribute - should be the C++ object or a memory view wrapper
78+
# Memory views keep a reference to the owner to prevent garbage collection
7879
assert result.base is not None
79-
# For memory views, base should reference back to the owning object
80-
# The exact type depends on Cython's memory view implementation
8180

8281
@pytest.mark.skip(reason="Mutable ref views require ensuring C++ object lifetime exceeds view lifetime - needs investigation of reference handling")
8382
def test_mutable_ref_output_is_view(self, numpy_vector_module):

0 commit comments

Comments
 (0)