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

Converters from numpy types to corresponding C++ types gone missing #249

Open
guitargeek opened this issue Jul 9, 2024 · 2 comments
Open

Comments

@guitargeek
Copy link
Contributor

guitargeek commented Jul 9, 2024

Reported originally on the ROOT forum:
https://root-forum.cern.ch/t/numpy-ints-not-accepted-in-ttree-getentry-in-root-6-32/59712/8

Reproducer:

import cppyy
import numpy as np

cppyy.cppdef("""
   std::int64_t foo(std::int64_t x) { return x; }
""")

print(cppyy.gbl.foo(np.int64(10)))

Output:

Traceback (most recent call last):
  File "/home/rembserj/root-support/forum/numpy-ints-not-accepted-in-ttree-getentry-in-root-6-32/repro.py", line 8, in <module>
    print(cppyy.gbl.foo(np.int64(10)))
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: long ::foo(std::int64_t x) =>
    TypeError: could not convert argument 1 (int/long conversion expects an integer object)

Expected output:

10

In fact, the expected behavior was occurring with a previous cppyy version used before ROOT 6.32. Therefore, this issue is a behavior regression that catches uses by surprise.

@wlav
Copy link
Owner

wlav commented Jul 11, 2024

Was support for numpy types added to the ROOT fork of cppyy? AFAIK, this has never worked in master.

@guitargeek
Copy link
Contributor Author

At least I couldn't identify a commit of patch that explicitly added support for it. I will try out a few different ROOT and cppyy versions to understand what is going on.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants