Problems with identification of arrays

I’ve noticed two different cases in which pyroot incorrectly identifies static arrays that have been defined in header files.

The first involves bool arrays. I seem to remember there were severe issues with these at one point, but now they work fine in 1D. However, a 2+ dimensional array still looks bugged - a proper python buffer is returned, but it has the wrong length - it gets the size of the first dimension only.

The second involves arrays of enum types. In this case, the variable in python just becomes a long, filled with the address of the first element in the array.

The header file I wrote to demonstrate this is here:

#ifndef MYFILE
#define MYFILE

namespace testing{
typedef enum mytype { kType1, kType2 } mytype_t;

static const mytype enumarray[2] = {kType1, kType2}; // gives pointer to first element, as long

static const bool boolarray[2][3] = {}; // gives: <read-write buffer ptr 0x7f8944937b80, size 2 at 0x7f89513a6f30>

}
#endif

The LinkDef I used was:

[code]#ifdef CINT

#pragma link off all globals;
#pragma link off all classes;
#pragma link off all functions;

#pragma link C++ namespace testing;

#pragma link C++ enum testing::mytype_t;

#endif[/code]

Hi,

arrays of non-builtin types and multi-dimensional arrays simply don’t work well with CINT. Life is somewhat better in ROOT6, especially for the former. The latter still needs work (the situation has greatly improved with the new Python buffer API since p2.6, but I have not have had the time to work on that).

Cheers,
Wim