Skip to content

Fixes for flake8 master#4213

Merged
asottile merged 1 commit intopytest-dev:masterfrom
asottile:flake8_master_fixes
Oct 23, 2018
Merged

Fixes for flake8 master#4213
asottile merged 1 commit intopytest-dev:masterfrom
asottile:flake8_master_fixes

Conversation

@asottile
Copy link
Member

I'm prepping the 3.6.0 flake8 release, figured I'd try some larger codebases :)

except Exception as e:
pass
except Exception as exc:
e = exc
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@RonnyPfannschmidt this one is subtle, and a new python3 behaviour:

exc = 'hi'
try:
    raise AssertionError('hello')
except Exception as exc:
    pass
print(exc)
$ python2 t.py
hello

$ python3 t.py 
Traceback (most recent call last):
  File "t.py", line 6, in <module>
    print(exc)
NameError: name 'exc' is not defined

from the docs

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fabulous work, thanks for digging

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So why was the assert e is not None below not causing a problem before? (since e should have been deleted)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, likely untested code - i.e. it returned instead of going there I assume.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Retry code that was never hit 🤷‍♂️

@asottile asottile merged commit 799b72c into pytest-dev:master Oct 23, 2018
@asottile asottile deleted the flake8_master_fixes branch October 23, 2018 03:08
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 this pull request may close these issues.

4 participants