8000 BUG: Instantiation of object arrays · Issue #29172 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content
BUG: Instantiation of object arrays #29172
Closed
@tenghamn

Description

@tenghamn

Describe the issue:

Instantiating a numpy object array to hold an array with dtype int converts the inner array to dtype object.

Reproduce the code example:

import numpy as np

# An object array holding an array with dtype int
obj_array = np.array([np.array([1], dtype=int)], dtype="object")

assert obj_array[0].dtype == int

Error message:

Python and NumPy Versions:

2.2.6
3.12.10 (main, Apr 29 2025, 00:24:54) [GCC 12.2.0]

Runtime Environment:

[{'numpy_version': '2.2.6',
'python': '3.12.10 (main, Apr 29 2025, 00:24:54) [GCC 12.2.0]',
'uname': uname_result(system='Linux', node='5fcd3020d297', release='6.6.87.1-microsoft-standard-WSL2', version='#1 SMP PREEMPT_DYNAMIC Mon Apr 21 17:08:54 UTC 2025', machine='x86_64')},
{'simd_extensions': {'baseline': ['SSE', 'SSE2', 'SSE3'],
'found': ['SSSE3',
'SSE41',
'POPCNT',
'SSE42',
'AVX',
'F16C',
'FMA3',
'AVX2'],
'not_found': ['AVX512F',
'AVX512CD',
'AVX512_KNL',
'AVX512_KNM',
'AVX512_SKX',
'AVX512_CLX',
'AVX512_CNL',
'AVX512_ICL']}},
{'architecture': 'Haswell',
'filepath': '/home/vscode/.local/lib/python3.12/site-packages/numpy.libs/libscipy_openblas64_-56d6093b.so',
'internal_api': 'openblas',
'num_threads': 14,
'prefix': 'libscipy_openblas',
'threading_layer': 'pthreads',
'user_api': 'blas',
'version': '0.3.29'}]

Context for the issue:

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0