-
-
Notifications
You must be signed in to change notification settings - Fork 32.5k
bpo-41520: Fix second codeop regression #21848
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
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -307,14 +307,17 @@ def test_filename(self): | |
|
||
def test_warning(self): | ||
# Test that the warning is only returned once. | ||
with warnings_helper.check_warnings((".*literal", SyntaxWarning)) as w: | ||
compile_command("0 is 0") | ||
self.assertEqual(len(w.warnings), 1) | ||
with warnings_helper.check_warnings( | ||
(".*literal", SyntaxWarning), | ||
(".*invalid", DeprecationWarning), | ||
) as w: | ||
compile_command(r"'\e' is 0") | ||
self.assertEqual(len(w.warnings), 2) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would it be possible to another test which only emits a single warning? For example, keep the existing "0 is 0" test, but add your new test as a new one (don't replace the existing one). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. check_warnings checks that each of the two warnings is called, so that 2 must be 1+1 and not 2+0, so the above is, in a sense, two independent tests. We are not testing builtin compile, but that compile_command only lets 1+1 of the 3+3 warnings pass to the caller. |
||
|
||
# bpo-41520: check SyntaxWarning treated as an SyntaxError | ||
with self.assertRaises(SyntaxError): | ||
with warnings.catch_warnings(), self.assertRaises(SyntaxError): | ||
warnings.simplefilter('error', SyntaxWarning) | ||
compile_command('1 is 1\n', symbol='exec') | ||
compile_command('1 is 1', symbol='exec') | ||
|
||
|
||
if __name__ == "__main__": | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
Fix :mod:`codeop` regression: it no longer ignores :exc:`SyntaxWarning`. | ||
Fix :mod:`codeop` regression that prevented turning compile warnings into errors. |
Uh oh!
There was an error while loading. Please reload this page.