Problem initialising C++ class members from PyROOT


I’ve noticed that I can initialise my C++ class members in PyROOT through constructor or some functions, but when I try to do the same through object properties, it does not work properly. In the attached example, the array that is written into b.v2 is also written in b.v1 (or rather b.v1 points in the same place as v2). Also, I can create additional object property (v7) and it will also show what v2 shows.

The output of my script is:

24.0 324.0
default constr
24.0 324.0
default constr
2340.0 2340.0 2340.0

The last line shows output after setting through object properties. It should be the same as values in previous lines. Please advice, if it is a bug or I am doing something wrong. (646 Bytes)
test_class.h (479 Bytes)

ROOT Version: 6.22.06
Platform: Fedora 33
Compiler: Not Provided

Many thanks for the detailed report! It looks to me like a bug so I created a corresponding issue. Our PyROOT expert is currently away, I’ll leave the final verdict to him.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.