Skip to content

gh-130080: fix warnings in tests #131400

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

Merged
merged 6 commits into from
Mar 18, 2025
Merged

gh-130080: fix warnings in tests #131400

merged 6 commits into from
Mar 18, 2025

Conversation

iritkatriel
Copy link
Member

@iritkatriel iritkatriel commented Mar 18, 2025

@iritkatriel iritkatriel requested a review from rhettinger as a code owner March 18, 2025 10:40
@bedevere-app bedevere-app bot added tests Tests in the Lib/test dir awaiting core review labels Mar 18, 2025
@bedevere-app bedevere-app bot mentioned this pull request Mar 18, 2025
@picnixz
Copy link
Member

picnixz commented Mar 18, 2025

Sorry, but I missed some cases when reporting the issue:

0:00:35 load avg: 2.64 [140/485] test_compile passed
<script>:8: SyntaxWarning: 'break' in a 'finally' block
<script>:10: SyntaxWarning: 'continue' in a 'finally' block
[and lots more]
/Lib/test/test_sys_settrace.py:927: SyntaxWarning: 'return' in a 'finally' block
  return 6
/Lib/test/test_sys_settrace.py:2238: SyntaxWarning: 'return' in a 'finally' block
  return
/Lib/test/test_sys_settrace.py:2769: SyntaxWarning: 'return' in a 'finally' block
0:01:09 load avg: 3.69 [439/485/1] test_unparse passed
<unknown>:926: SyntaxWarning: 'break' in a 'finally' block
<unknown>:935: SyntaxWarning: 'break' in a 'finally' block
[and lots more]
0:01:12 load avg: 3.63 [472/485/1] test_yield_from passed
/Lib/test/test_yield_from.py:1524: SyntaxWarning: 'return' in a 'finally' block

The reported warnings were only found while doing PGO build.

break
self.assertEqual(count, 1)
with warnings.catch_warnings():
warnings.simplefilter('ignore', SyntaxWarning)
Copy link
Contributor

Choose a reason for hiding this comment

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

How does this fix work? The SyntaxWarning is issued when the file is imported so this block hasn't run yet

Copy link
Member Author

Choose a reason for hiding this comment

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

Right. I'll refix this.

colesbury pushed a commit to colesbury/cpython that referenced this pull request Mar 20, 2025
seehwan pushed a commit to seehwan/cpython that referenced this pull request Apr 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
skip news tests Tests in the Lib/test dir
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants