deepcopy on dataset with private block fails
kwijk opened this issue · comments
kwijk commented
Recursion in deep copy when running:
ds = pydicom.data.get_testdata_file("MR_small.dcm", read=True)
block = ds.private_block(0x000b, "My company 001", create=True)
ds2 = copy.deepcopy(ds)
../venv/lib/python3.11/site-packages/pydicom/dataset.py:2803: in _copy_implementation
copied.__dict__[k] = copy_function(v)
E RecursionError: maximum recursion depth exceeded while calling a Python object
The reason for this recursion may be that class PrivateBlock has a reference to it parent dataset.
Your environment
module | version |
---|---|
platform | Linux-6.7.9-arch1-1-x86_64-with-glibc2.39 |
Python | 3.11.8 (main, Feb 12 2024, 14:50:05) [GCC 13.2.1 20230801] |
pydicom | 2.4.4 |
gdcm | module not found |
jpeg_ls | module not found |
numpy | 1.26.4 |
PIL | module not found |
pylibjpeg | 2.0.0 |
openjpeg | 2.1.1 |
libjpeg | 2.0.2 |
scaramallion commented
Thanks, it'll get fixed in the next release