Skip to content

[v632][CPyCppyy] Drop __array__ from std::vector pythonizations#18267

Merged
guitargeek merged 1 commit into
root-project:v6-32-00-patchesfrom
aaronj0:bp-cppyy-fix
Apr 4, 2025
Merged

[v632][CPyCppyy] Drop __array__ from std::vector pythonizations#18267
guitargeek merged 1 commit into
root-project:v6-32-00-patchesfrom
aaronj0:bp-cppyy-fix

Conversation

@aaronj0
Copy link
Copy Markdown
Contributor

@aaronj0 aaronj0 commented Apr 4, 2025

Backport of #18208

The addition of the __array__ utility to std::vector Python proxies causes a
bug where the resulting array is a single dimension, causing loss of data when
converting to numpy arrays, for >1dim vectors. The recursive nature of this
function, passes each subarray (pydata) to the next call and only the final
buffer is cast to a lowlevel view and resized (in VectorData), resulting in
only the first 1D array to be returned. See root-project#17729

Since this C++ pythonization was added with the upgrade in 6.32, and is only
defined and used recursively, the safe option is to disable this function and
no longer add it. It is temporarily removed to prevent errors due to -Wunused-function
@aaronj0 aaronj0 changed the title [CPyCppyy] Drop __array__ from std::vector pythonizations [bp][CPyCppyy] Drop __array__ from std::vector pythonizations Apr 4, 2025
@aaronj0 aaronj0 changed the title [bp][CPyCppyy] Drop __array__ from std::vector pythonizations [v632][CPyCppyy] Drop __array__ from std::vector pythonizations Apr 4, 2025
@aaronj0 aaronj0 self-assigned this Apr 4, 2025
@guitargeek guitargeek merged commit 511d582 into root-project:v6-32-00-patches Apr 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants