BUG: ctypes conversions of numpy scalars share the same buffer · Issue #30354 · numpy/numpy · GitHub
Skip to content

BUG: ctypes conversions of numpy scalars share the same buffer #30354

Description

@mtsokol

Describe the issue:

Originally reported in finch-tensor/finch-tensor#248 (comment)

Possibly ctypes conversions of numpy scalars all share the same buffer.

Reproduce the code example:

import numpy as np
import numpy.ctypeslib as ctl

a = np.int64(2)
b = np.int64(1)

s1 = ctl.as_ctypes(a)
s2 = ctl.as_ctypes(b)

print(s1.value, s2.value)
# this prints 1 1

Python and NumPy Versions:

2.3.3
3.12.11 | packaged by conda-forge | (main, Jun 4 2025, 14:38:53) [Clang 18.1.8 ]

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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