Skip to content

Commit c7c0378

Browse files
committed
Copy weight and mass on return
1 parent 4ac74b3 commit c7c0378

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/scippneutron/atoms/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def atomic_weight(self) -> sc.Variable:
4242
"This likely means that there is no standard atomic weight "
4343
"for this element."
4444
)
45-
return self._atomic_weight
45+
return self._atomic_weight.copy()
4646

4747
@property
4848
def atomic_mass(self) -> sc.Variable:
@@ -53,7 +53,7 @@ def atomic_mass(self) -> sc.Variable:
5353
"This likely means that you specified an element name, not a specific "
5454
"isotope; atomic masses are only defined for isotopes / nuclides."
5555
)
56-
return self._atomic_mass
56+
return self._atomic_mass.copy()
5757

5858
def __eq__(self, other: object) -> bool | type(NotImplemented):
5959
if not isinstance(other, Atom):

0 commit comments

Comments
 (0)