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

[Bug-Candidate]: use default_factory #2005

Closed
mimoo opened this issue Jun 27, 2023 · 1 comment
Closed

[Bug-Candidate]: use default_factory #2005

mimoo opened this issue Jun 27, 2023 · 1 comment
Labels
bug-candidate Bugs reports that are not yet confirmed

Comments

@mimoo
Copy link

mimoo commented Jun 27, 2023

Describe the issue:

Getting the following error right after install when I try to use any command of slither:

Traceback (most recent call last):
  File "/usr/local/bin/slither", line 5, in <module>
    from slither.__main__ import main
  File "/usr/local/lib/python3.11/site-packages/slither/__main__.py", line 24, in <module>
    from slither.printers import all_printers
  File "/usr/local/lib/python3.11/site-packages/slither/printers/all_printers.py", line 4, in <module>
    from .summary.loc import LocPrinter
  File "/usr/local/lib/python3.11/site-packages/slither/printers/summary/loc.py", line 14, in <module>
    from slither.utils.loc import compute_loc_metrics
  File "/usr/local/lib/python3.11/site-packages/slither/utils/loc.py", line 20, in <module>
    @dataclass
     ^^^^^^^^^
  File "/usr/local/Cellar/[email protected]/3.11.2_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/dataclasses.py", line 1220, in dataclass
    return wrap(cls)
           ^^^^^^^^^
  File "/usr/local/Cellar/[email protected]/3.11.2_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/dataclasses.py", line 1210, in wrap
    return _process_class(cls, init, repr, eq, order, unsafe_hash,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/Cellar/[email protected]/3.11.2_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/dataclasses.py", line 958, in _process_class
    cls_fields.append(_get_field(cls, name, type, kw_only))
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/Cellar/[email protected]/3.11.2_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/dataclasses.py", line 815, in _get_field
    raise ValueError(f'mutable default {type(f.default)} for field '
ValueError: mutable default <class 'slither.utils.loc.LoCInfo'> for field src is not allowed: use default_factory

Code example to reproduce the issue:

$ pip3 --version
pip 23.1.2 from /usr/local/lib/python3.11/site-packages/pip (python 3.11)
$ pip3 install slither-analyzer
$ slither --version

Version:

I get the error when I run that

Relevant log output:

No response

@mimoo mimoo added the bug-candidate Bugs reports that are not yet confirmed label Jun 27, 2023
@0xalpharush
Copy link
Contributor

0xalpharush commented Jun 28, 2023

@mimoo We just released 0.9.5 to fix this!

Closed by #2002

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug-candidate Bugs reports that are not yet confirmed
Projects
None yet
Development

No branches or pull requests

2 participants