-
-
Notifications
You must be signed in to change notification settings - Fork 34k
bpo-42349: Compiler clean up. More yak-shaving for PEP 626. #23267
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can not use lists in a news entry.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Newlines in news entries are 'soft' so that each is re-wrapped to line lengths of (on my screen) 5 1/2 to 9 inches. (Shorter screen space get a horizontal scrollbar, longer has the extra space ignored.) The *s are not needed here anyway.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for pointing that out. Fixed.
Lib/test/test_compile.py
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To run all funcs and report each failure...
| opcodes = list(dis.get_instructions(func)) | |
| self.assertEqual(2, len(opcodes)) | |
| self.assertIn('LOAD_', opcodes[0].opname) | |
| self.assertEqual('RETURN_VALUE', opcodes[1].opname) | |
| with self.subTest(func=func): | |
| opcodes = list(dis.get_instructions(func)) | |
| self.assertEqual(2, len(opcodes)) | |
| self.assertIn('LOAD_', opcodes[0].opname) | |
| self.assertEqual('RETURN_VALUE', opcodes[1].opname) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
Lib/test/test_dis.py
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As near as I could tell, the only different between the two strings is the 1 or 2 lines of Contents, so that the two could be replaced by one f string with
{" 0: None\n" if sys.flags.optimize else "
" 0: 'Formatted details of methods, functions, or code.'\n 1: None\n"}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can't put backslashes in f-strings, apparently 😞
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could use .format(...) instead, like we used to have to do. Or precalculate contents = ... before the string. But replacing " with ''' and either deleting \n or replacing with a literal newline should work. Revised suggested addition based on local testing:
{''' 0: None'''
if sys.flags.optimize else
''' 0: 'Formatted details of methods, functions, or code.'
1: None'''}
The newline after the closing } is added to either interpolation, so only one internal newline is needed between ''' quotes. The two trailing 'ns were a mistake. Put if ... else on a separate line or not; unquoted newlines between { and } do not matter.
|
When you're done making the requested changes, leave the comment: |
…aggresive in the compiler back-end.
007337e to
0c25036
Compare
24cf1a2 to
3ff30ba
Compare
|
🤖 New build scheduled with the buildbot fleet by @markshannon for commit 4c61adc 🤖 If you want to schedule another build, you need to add the ":hammer: test-with-buildbots" label again. |
…-23267) Make sure that CFG from compiler front-end is correct. Be a bit more aggressive in the compiler back-end.


This PR:
LOAD_CONST const; conditional jumppairs.https://bugs.python.org/issue42349