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

Collection full_copy and clone don't actually deepcopy #787

Closed
evetion opened this issue Apr 6, 2022 · 0 comments · Fixed by #794
Closed

Collection full_copy and clone don't actually deepcopy #787

evetion opened this issue Apr 6, 2022 · 0 comments · Fixed by #794
Labels
bug Things which are broken

Comments

@evetion
Copy link

evetion commented Apr 6, 2022

When I clone or full_copy a Collection, its extra_fields, are not deepcopied. Mutating the copy will mutate the original:

from pystac import Collection, Extent, SpatialExtent, TemporalExtent

data = {"test": "1"}
a = Collection(id="test", description="test", extra_fields=data, extent=Extent(spatial=SpatialExtent(bboxes=[0,0,0,0]), temporal=TemporalExtent(intervals=[0,0])))

b = a.full_copy()
b.extra_fields.pop("test")
a.extra_fields  # {}

This probably also happens to Catalogs and to more fields than just extra_fields as well.

@gadomski gadomski added the bug Things which are broken label Apr 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Things which are broken
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants