Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: generate an array view when an Array C++ type is requested #2335

Merged
merged 1 commit into from
Mar 22, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions src/awkward/highlevel.py
Original file line number Diff line number Diff line change
Expand Up @@ -1474,12 +1474,14 @@ def cpp_type(self):
"""
ak.cppyy.register_and_check()

import cppyy

if self._cpp_type is None:
# FIXME: see where and if to keep the lookup
self._generator = ak._connect.cling.togenerator(
self.layout.form, flatlist_as_rvec=False
)
self._lookup = ak._lookup.Lookup(self.layout)
self._generator.generate(cppyy.cppdef)
self._cpp_type = f"awkward::{self._generator.class_type()}"

return self._cpp_type
Expand All @@ -1491,11 +1493,11 @@ def __cast_cpp__(self):
parameters needed to construct the C++ type of this Array when it is
used in cppyy.
"""
import cppyy

if self._cpp_type is None:
self._cpp_type = self.cpp_type

import cppyy

return getattr(cppyy.gbl, self._cpp_type)(
0, len(self), 0, self._lookup.arrayptrs, 0
)
Expand Down