Commit 5872dda
Set .base to self for reference returns, verify in tests
Fixed the .base attribute handling as requested:
- For reference returns: Explicitly set (<numpy.ndarray>arr).base = self to keep owner alive
- For value returns: ArrayWrapper automatically set as .base by buffer protocol (already working)
- Updated test to verify .base is the owner object (not memoryview)
This ensures proper lifetime management - the numpy array keeps the C++ object alive to prevent premature garbage collection.
Commit addresses comment 3679292583
Co-authored-by: jpfeuffer <8102638+jpfeuffer@users.noreply.github.com>1 parent b2e1d0c commit 5872dda
File tree
3 files changed
+8
-4
lines changed- autowrap
- tests
- test_files/numpy_vector
3 files changed
+8
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2248 | 2248 | | |
2249 | 2249 | | |
2250 | 2250 | | |
2251 | | - | |
2252 | | - | |
| 2251 | + | |
2253 | 2252 | | |
2254 | 2253 | | |
2255 | 2254 | | |
| |||
2258 | 2257 | | |
2259 | 2258 | | |
2260 | 2259 | | |
| 2260 | + | |
2261 | 2261 | | |
2262 | 2262 | | |
2263 | 2263 | | |
| |||
2272 | 2272 | | |
2273 | 2273 | | |
2274 | 2274 | | |
| 2275 | + | |
2275 | 2276 | | |
2276 | 2277 | | |
2277 | 2278 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
743 | 743 | | |
744 | 744 | | |
745 | 745 | | |
| 746 | + | |
746 | 747 | | |
747 | 748 | | |
748 | 749 | | |
| |||
754 | 755 | | |
755 | 756 | | |
756 | 757 | | |
| 758 | + | |
757 | 759 | | |
758 | 760 | | |
759 | 761 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
74 | 74 | | |
75 | 75 | | |
76 | 76 | | |
77 | | - | |
78 | | - | |
| 77 | + | |
| 78 | + | |
79 | 79 | | |
| 80 | + | |
80 | 81 | | |
81 | 82 | | |
82 | 83 | | |
| |||
0 commit comments