Skip to content

[cppyy] cast to long long pointer result in unsigned long long pointer #21431

@AlkaidCheng

Description

@AlkaidCheng

Check duplicate issues.

  • Checked for duplicates

Description

Casting an int64 numpy array into a signed long long pointer gives an unsigned long long pointer instead.

Reproducer

import cppyy
import cppyy.ll
import numpy as np

arr = np.array([-1, 0, 1], dtype=np.int64)
view = cppyy.ll.cast[f"long long*"](arr.ctypes.data)
# prints 18446744073709551615 instead of -1
print(view[0])
# prints 'L' instead of 'l'
print(view.typecode)

ROOT version

cppyy==3.5.0

Installation method

conda (bundled with root)

Operating system

Linux

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions