MartinThoma / flake8-simplify

❄ A flake8 plugin that helps you to simplify code
MIT License
186 stars 19 forks source link

Segfault when executing from pytest #66

Closed scganterh closed 3 years ago

scganterh commented 3 years ago

Desired change

Explanation

When I execute flake8 using pytest like this pytest --flake8 --mypy I get the following segfault:

Current thread 0x00007ffff7ff4740 (most recent call first):
  File "venv/lib/python3.6/site-packages/flake8_simplify.py", 
line 941 in is_stmt_equal
  File "venv/lib/python3.6/site-packages/flake8_simplify.py", 
line 947 in is_stmt_equal
...
  File "venv/lib/python3.6/site-packages/flake8_simplify.py", 
line 947 in is_stmt_equal
  File "venv/lib/python3.6/site-packages/flake8_simplify.py", 
line 947 in is_stmt_equal
  ...
Segmentation fault

I know this error may not give enough information but I have no idea how to debug this. Also, I noticed this happens only in versions 0.12.0 to 0.14.1, but not in 0.11.0 and only with the exact parameters mentioned above. If for instance I run pytest --flake8 or just flake8 . --exclude venv the problem will not occur.

ghost commented 3 years ago

@scganterh can you confirm if https://github.com/MartinThoma/flake8-simplify/pull/69 solves your issue? I believe it should.

@MartinThoma is there anything else I would need to do to help merge this?

MartinThoma commented 3 years ago

@dbdbc I'm sorry it took me so long to merge. I've just noticed it and merged. Thank you for the ping!

MartinThoma commented 3 years ago

I've also now pushed a new version on PyPI

ghost commented 3 years ago

Thanks for merging!

MartinThoma commented 3 years ago

@scganterh It would be awesome if you could confirm that this worked :-)