Skip to content

[PyROOT] The cppyy version inside ROOT doesn't support long long #15872

@guitargeek

Description

@guitargeek

Description

After removing a patch from the cppyy inside ROOT in 8d2a6df, the built-in cppyy somehow doesn't support long long anymore. This only became apparent now that the Long64_t converter is only registered when setting up PyROOT.

Note that the reproducer works in upstream cppyy. Maybe because the type name "long long" is two words, and upstream cppyy somehow fixed it by patching ROOT meta?

It's not an urgent problem, because it's easy to fix by importing ROOT, but it would be nice to understand what is going on. Because maybe it means that once this problem with long long is fixed, we don't need the converter aliases for PyROOT at all!

Reproducer

import cppyy

# import ROOT # setting up PyROOT would fix the problem
# ROOT.gInterpreter

cppyy.cppdef("""
#include <cstdint>
namespace cool {
typedef long long Bad_t;
typedef std::int64_t Goot_t;
const Bad_t bad_value = +9223372036854775807;
const Goot_t good_value = +9223372036854775807;
}
""")

print(cppyy.gbl.cool.bad_value)
print(cppyy.gbl.cool.good_value)

Will crash with:

Traceback (most recent call last):
  File "/home/rembserj/repro.py", line 16, in <module>
    print(cppyy.gbl.cool.bad_value)
          ^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: <namespace cppyy.gbl.cool at 0x64765cfce570> has no attribute 'bad_value'. Full details:
  type object 'cool' has no attribute 'bad_value'
  'cool::bad_value' is not a known C++ class
  C++ type cannot be converted from memory. Did you mean: 'good_value'?

ROOT version

ROOT master.

Metadata

Metadata

Assignees

Type

No type

Projects

Status

No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions