Skip to content

BUG: Crash with copy.deepcopy when using StringDType #28609

@vnmabus

Description

@vnmabus

Describe the issue:

When trying to deepcopy an array with the StringDType dtype, the process crash with an access violation (in both Windows and Linux). The following code triggers the error (I tried both with numpy==2.1.3 and with the last released one, numpy==2.2.4).

Reproduce the code example:

import numpy as np
import copy       
a = np.array(["kk"], dtype=np.dtypes.StringDType())
b = copy.deepcopy(a)

Error message:

Windows fatal exception: access violation

Current thread 0x00005290 (most recent call first):
  File "c:\Users\carlo\git\scikit-fda\.conda\Lib\copy.py", line 143 in deepcopy
  File "<stdin>", line 1 in <module>

Python and NumPy Versions:

2.2.4
3.12.8 | packaged by conda-forge | (main, Dec 5 2024, 14:06:27) [MSC v.1942 64 bit (AMD64)]

Runtime Environment:

[{'numpy_version': '2.2.4',
'python': '3.12.8 | packaged by conda-forge | (main, Dec 5 2024, 14:06:27) '
'[MSC v.1942 64 bit (AMD64)]',
'uname': uname_result(system='Windows', node='Turing', release='11', version='10.0.26100', machine='AMD64')},
{'simd_extensions': {'baseline': ['SSE', 'SSE2', 'SSE3'],
'found': ['SSSE3',
'SSE41',
'POPCNT',
'SSE42',
'AVX',
'F16C',
'FMA3',
'AVX2'],
'not_found': ['AVX512F',
'AVX512CD',
'AVX512_SKX',
'AVX512_CLX',
'AVX512_CNL',
'AVX512_ICL']}},
{'architecture': 'Haswell',
'filepath': 'C:\Users\carlo\git\scikit-fda\.conda\Lib\site-packages\numpy.libs\libscipy_openblas64_-43e11ff0749b8cbe0a615c9cf6737e0e.dll',
'internal_api': 'openblas',
'num_threads': 20,
'prefix': 'libscipy_openblas',
'threading_layer': 'pthreads',
'user_api': 'blas',
'version': '0.3.28'}]

Context for the issue:

I am rewriting some data structures to use StringDType for some array attributes. These structures need to be copy-able, which this bug prevents.

Note that the version of NumPy I am currently using is 2.1.3, because is the latest supported by Numba. Thus it would be good if the fix was also backported.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions