Skip to content

Commit

Permalink
Fix execution in Python 3.11
Browse files Browse the repository at this point in the history
This fixes the following error:

  ValueError: mutable default <class 'slither.utils.loc.LoCInfo'> for field src is not allowed: use default_factory
  • Loading branch information
elopez committed Jun 26, 2023
1 parent 273cca4 commit cbe6716
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions slither/utils/loc.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from dataclasses import dataclass
from dataclasses import dataclass, field
from pathlib import Path
from typing import List, Tuple

Expand All @@ -19,9 +19,9 @@ def total(self) -> int:

@dataclass
class LoC:
src: LoCInfo = LoCInfo()
dep: LoCInfo = LoCInfo()
test: LoCInfo = LoCInfo()
src: LoCInfo = field(default_factory=LoCInfo)
dep: LoCInfo = field(default_factory=LoCInfo)
test: LoCInfo = field(default_factory=LoCInfo)

def to_pretty_table(self) -> MyPrettyTable:
table = MyPrettyTable(["", "src", "dep", "test"])
Expand Down

0 comments on commit cbe6716

Please sign in to comment.