Skip to content

Commit f1b2f17

Browse files
fix(records): avoid mutating dumped properties
Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent 1bad1ec commit f1b2f17

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

  • cognite/client/data_classes/data_modeling

cognite/client/data_classes/data_modeling/records.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from __future__ import annotations
22

33
from collections.abc import Mapping, Sequence
4+
from copy import deepcopy
45
from dataclasses import dataclass
56
from typing import Any, Literal
67

@@ -71,7 +72,7 @@ def _load(cls, resource: dict[str, Any]) -> Self:
7172
def dump(self, camel_case: bool = True) -> dict[str, Any]:
7273
return {
7374
"source": self.source.dump(camel_case=camel_case),
74-
"properties": self.properties,
75+
"properties": deepcopy(self.properties),
7576
}
7677

7778

@@ -258,7 +259,7 @@ def dump(self, camel_case: bool = True) -> dict[str, Any]:
258259
"status": self.status,
259260
}
260261
if self.properties is not None:
261-
output["properties"] = self.properties
262+
output["properties"] = deepcopy(self.properties)
262263
return output
263264

264265
def as_id(self) -> RecordId:

0 commit comments

Comments
 (0)