Skip to content

Commit d7ec325

Browse files
saiarcot895lguohan
authored andcommitted
Fix error about having a mutable default for field headers in dataclass
Newer versions of Python error out on mutable default fields in a dataclass, and the fix for that appears to be using the `default_factory` attribute in `field`. This appears to at least pass the tests. Signed-off-by: Saikrishna Arcot <[email protected]>
1 parent 0ab3ab9 commit d7ec325

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

sonic_package_manager/constraint.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ class PackageConstraint:
117117

118118
name: str
119119
constraint: VersionConstraint
120-
_components: ComponentConstraints = ComponentConstraints({})
120+
_components: ComponentConstraints = field(default_factory=ComponentConstraints)
121121

122122
def __str__(self): return f'{self.name}{self.constraint}'
123123

0 commit comments

Comments
 (0)