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 with string and format operator is fixed incorrectly #192

Open
dwvisser opened this issue Jul 29, 2019 · 2 comments
Open

Raise with string and format operator is fixed incorrectly #192

dwvisser opened this issue Jul 29, 2019 · 2 comments

Comments

@dwvisser
Copy link

This is similar to issue #180, which appears to have been closed without any justification given. Here's the relevant portion of the output of python-modernize (v0.7) which illustrates the bug:

--- test_modernize_formatted_raise.py	(original)
+++ test_modernize_formatted_raise.py	(refactored)
@@ -1,4 +1,4 @@
 def hello(name, language):
     if language is None:
-        raise('Language for %s not defined' % name)
+        raise 'Language for %s not defined'
     pass
@dwvisser
Copy link
Author

I see that in Python 3 that raise has been changed to only accept a single argument, which must be an expression that resolves to something that is BaseException or derived from it. I think that python-modernize should emit warning messages at least on these refactorings.

@ngie-eign
Copy link

Wow. Yeah, that's really broken code :/...

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

2 participants