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

crash on tuple expansion in try/except block #153

Closed
neutrinoceros opened this issue Dec 23, 2020 · 1 comment · Fixed by #161
Closed

crash on tuple expansion in try/except block #153

neutrinoceros opened this issue Dec 23, 2020 · 1 comment · Fixed by #161

Comments

@neutrinoceros
Copy link
Contributor

Running flake8 against the following file produces no report as an exception is raised in bugbear

# dummy.py
grey_list = (ValueError,)
black_list = (TypeError,)

try:
    int("1e3")
except (*grey_list, *black_list):
    print("error caught")

crashes with

Traceback (most recent call last):
...
  File "/Users/clm/.pyenv/versions/3.8.6/envs/yt_dev/lib/python3.8/site-packages/bugbear.py", line 126, in _to_name_str
    assert isinstance(node, ast.Attribute)
AssertionError

For information

$ flake8 --version
3.8.4 (flake8-bugbear: 20.11.1, mccabe: 0.6.1, pycodestyle: 2.6.0, pyflakes: 2.2.0) CPython 3.8.6 on Darwin
@neutrinoceros
Copy link
Contributor Author

I've started looking around for a solution and I notice that bugbear relies on hypothesmith to check that it doesn't crash on "any" valid code, but I guess hypothesmith.from_grammar() doesn't ever generate something like this. I'm going to try and solve the issue in bugbear but it should be reported upstream at some point.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant