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

raise not inside exception block #240

Closed
pyflakes-bot opened this issue Dec 22, 2015 · 2 comments
Closed

raise not inside exception block #240

pyflakes-bot opened this issue Dec 22, 2015 · 2 comments

Comments

@pyflakes-bot
Copy link

Original report by jayvdb (@jayvdb?) on Launchpad:


raise without any arguments inside an exception block can re-raise the exception.

outside an exception block it causes the following on at least 2.7:

TypeError: exceptions must be old-style classes or derived from BaseException, not NoneType

@pyflakes-bot
Copy link
Author

Original comment by jayvdb (@jayvdb?) on Launchpad:


Fix PR: #57

@pyflakes-bot
Copy link
Author

Original comment by bitglue (@bitglue?) on Launchpad:


This is valid Python code:

def foo():
raise

def bar():
try:
raise Exception()
except:
foo()

As such, a raise outside an except: block isn't an error per se: it depends on the call stack from which its called. Since we can't know that until runtime I don't think it's something Pyflakes can check.

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

No branches or pull requests

1 participant