Closed MaartenBaert closed 6 days ago
It looks like "CI / 🐍 3 • Clang 15 • C++20 • x64" was a spurious failure unrelated to my change.
It looks like "CI / 🐍 3 • Clang 15 • C++20 • x64" was a spurious failure unrelated to my change.
Yes, certainly unrelated. Similarly, "🐍 3 • Clang dev • C++11 • x64", it seems to be stuck on a wget for 2+ hours.
Looks good, thanks for the great work on the tests!
I added one commit: a1b7094a5507ef243dad2deea1cb44bef993bc0d
I also git merged master.
Waiting for GitHub Actions to finish.
The "CI / 🐍 3 • windows-latest • mingw32 (pull_request)" is also definitely unrelated. Everything else works. Merging. Thanks @MaartenBaert!
Description
This commit adds improved support for NumPy arrays with object dtype, by allowing users to access such arrays as
array_t<handle>
orarray_t<object>
, which are more convenient thanarray_t<PyObject*>
(which was introduced in PR #4674). In particular,array_t<object>
provides automatic memory management.This feature relies on the fact that
object
andhandle
have the same memory layout asPyObject*
, i.e.sizeof(object) == sizeof(handle) == sizeof(PyObject*)
. If this is somehow not the case, theenable_if_t
test should automatically disable this feature.I have also extended and improved the tests related to this feature with additional tests to detect memory leaks due to incorrect refcounts.
Suggested changelog entry: