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

Fix deepcopy of Dataset and Sequence #1814

Merged
merged 2 commits into from Jun 18, 2023
Merged

Conversation

CPBridge
Copy link
Contributor

@CPBridge CPBridge commented Jun 18, 2023

Describe the changes

Fix for #1813.

In the __deepcopy__ methods of Sequence and Dataset, the returned object should be initialised to an instance of the type of self rather than the literal Dataset and Sequence types. This way the methods also work for subclasses.

Since this has caused some significant issues with highdicom, wsiDicomizer, and possibly other libraries, would you consider a 2.4.1 patch release for this fix?

Tasks

  • [ x] Unit tests added that reproduce the issue or prove feature is working
  • [ x] Fix or feature added
  • [ x] Code typed and mypy shows no errors
  • Documentation updated (if relevant)
    • No warnings during build
    • Preview link (CircleCI -> Artifacts -> doc/_build/html/index.html)
  • [ x] Unit tests passing and overall coverage the same or better

@darcymason
Copy link
Member

Thanks for this, Chris. As soon as I saw it I had a d'oh! moment - of course the class names should not have been used directly.

would you consider a 2.4.1 patch release for this fix?

Absolutely, I'll see if I can publish it right away, but if any problems come up it may be a day or two.

@darcymason darcymason merged commit 6d29252 into pydicom:main Jun 18, 2023
2 checks passed
darcymason pushed a commit that referenced this pull request Jun 18, 2023
* Use __class__ for subtypes

* Add tests
@darcymason
Copy link
Member

I'll see if I can publish it right away, but if any problems come up it may be a day or two.

Well, not enough time -- other commitments, but I will try for later today.

@CPBridge
Copy link
Contributor Author

Thanks Darcy!

@darcymason
Copy link
Member

Ok, 2.4.1 has been published.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants