Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deepcopy on dataset with private block fails #2025

Open
kwijk opened this issue Mar 11, 2024 · 1 comment
Open

deepcopy on dataset with private block fails #2025

kwijk opened this issue Mar 11, 2024 · 1 comment
Labels
Milestone

Comments

@kwijk
Copy link

kwijk commented Mar 11, 2024

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
Copy link
Member

Thanks, it'll get fixed in the next release

@scaramallion scaramallion added this to the v3.0 milestone Mar 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants