diff options
author | Eric Wieser <wieser.eric@gmail.com> | 2018-08-11 16:01:48 -0700 |
---|---|---|
committer | Eric Wieser <wieser.eric@gmail.com> | 2018-10-30 22:36:24 -0700 |
commit | f2d8aabaf99bc2c460968d64aec67ae2570726bd (patch) | |
tree | 59ca29177191ff6be96eaa1469a3ee2c6da68cce /doc | |
parent | 7a0950649db5b83a881d8fb2bf8f95fdd885e081 (diff) | |
download | numpy-f2d8aabaf99bc2c460968d64aec67ae2570726bd.tar.gz |
BUG: Make `arr.ctypes.data` hold onto a reference to the underlying array
We do this by going through ctypes.from_buffer, which keeps the object the buffer came from alive.
A bunch of hacks are required to produce a sufficiently simple buffer for ctypes to accept.
Fixes #9647
Diffstat (limited to 'doc')
-rw-r--r-- | doc/release/1.16.0-notes.rst | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/doc/release/1.16.0-notes.rst b/doc/release/1.16.0-notes.rst index 89a4623e1..7c3cb04b6 100644 --- a/doc/release/1.16.0-notes.rst +++ b/doc/release/1.16.0-notes.rst @@ -268,6 +268,11 @@ copying the data directly into the appropriate slice of the resulting array. This results in significant speedups for these large arrays, particularly for arrays being blocked along more than 2 dimensions. +``arr.ctypes.data_as(...)`` holds a reference to arr +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Previously the caller was responsible for keeping the array alive for the +lifetime of the pointer. + Speedup ``np.take`` for read-only arrays ---------------------------------------- The implementation of ``np.take`` no longer makes an unnecessary copy of the |