| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| Expand Up | @@ -644,16 +644,25 @@ def func(): | |
| 4 | ||
| else: | ||
| 6 | ||
| if False: | ||
|
Comment thread
Copy link
Copy Markdown
Member
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. Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualityDoes this cover the original issue?
Sorry, something went wrong.
All reactions
Copy link
Copy Markdown
Member
Author
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. Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualityThe test did fail without the fix. But sure, I'll add a test with a non const.
Sorry, something went wrong.
All reactions
|
||
| 8 | ||
| else: | ||
| 10 | ||
| if func.__name__ == 'Fred': | ||
| 12 | ||
| finally: | ||
| 8 | ||
| 14 | ||
|
|
||
| self.run_and_compare(func, | ||
| [(0, 'call'), | ||
| (1, 'line'), | ||
| (2, 'line'), | ||
| (6, 'line'), | ||
| (8, 'line'), | ||
| (8, 'return')]) | ||
| (7, 'line'), | ||
| (10, 'line'), | ||
| (11, 'line'), | ||
| (14, 'line'), | ||
| (14, 'return')]) | ||
|
|
||
| def test_nested_loops(self): | ||
|
|
||
| Expand Down Expand Up | @@ -1222,16 +1231,25 @@ def func(): | |
| 4 | ||
| else: | ||
| 6 | ||
| if False: | ||
| 8 | ||
| else: | ||
| 10 | ||
| if func.__name__ == 'Fred': | ||
| 12 | ||
| finally: | ||
| 8 | ||
| 14 | ||
|
|
||
| self.run_and_compare(func, | ||
| [(0, 'call'), | ||
| (1, 'line'), | ||
| (2, 'line'), | ||
| (6, 'line'), | ||
| (8, 'line'), | ||
| (8, 'return')]) | ||
| (7, 'line'), | ||
| (10, 'line'), | ||
| (11, 'line'), | ||
| (14, 'line'), | ||
| (14, 'return')]) | ||
|
|
||
| def test_try_except_star_named_no_exception(self): | ||
|
|
||
| Expand Down | ||
| Back | FazBrowse Home | New Git URL |
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.
Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualityThere are 9 more opcodes generated now. Looks like that jump enabled some optimisation.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
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.
Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality@gvanrossum this PR fixes a regression from the except* PR and it’s all very odd, both the bug and the impact of the fix.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
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.
Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualityTracing is Mark's black magic these days (I don't claim to understand the line number table code).
Could it be that test_dis.py wasn't properly regenerated in a while? It's always struck me as odd that there isn't a more direct way to cause this data to be regenerated.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
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.
Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualityThe tests fail if you don’t update it.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
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.
Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualityI extracted it out of the test. I think with this PR it emits the finally body 4 times, and without it 3 times?
def jumpy(): try: 1 / 0 except ZeroDivisionError: print("Here we go, here we go, here we go...") else: with i as dodgy: print("Never reach this") finally: print("OK, now we're done") import dis dis.dis(jumpy)Old:
1 0 RESUME 0 2 2 NOP 3 4 LOAD_CONST 1 (1) 6 LOAD_CONST 2 (0) 8 BINARY_OP 11 (/) 10 POP_TOP 12 JUMP_FORWARD 14 (to 42) >> 14 PUSH_EXC_INFO 4 16 LOAD_GLOBAL 0 (ZeroDivisionError) 18 JUMP_IF_NOT_EXC_MATCH 17 (to 34) 20 POP_TOP 5 22 LOAD_GLOBAL 1 (print) 24 LOAD_CONST 3 ('Here we go, here we go, here we go...') 26 CALL_NO_KW 1 28 POP_TOP 30 POP_EXCEPT 32 JUMP_FORWARD 34 (to 102) 4 >> 34 RERAISE 0 >> 36 COPY 3 38 POP_EXCEPT 40 RERAISE 1 7 >> 42 LOAD_GLOBAL 2 (i) 44 BEFORE_WITH 46 STORE_FAST 0 (dodgy) 8 48 LOAD_GLOBAL 1 (print) 50 LOAD_CONST 4 ('Never reach this') 52 CALL_NO_KW 1 54 POP_TOP 7 56 LOAD_CONST 0 (None) 58 DUP_TOP 60 DUP_TOP 62 CALL_NO_KW 3 64 POP_TOP 66 JUMP_FORWARD 11 (to 90) >> 68 PUSH_EXC_INFO 70 WITH_EXCEPT_START 72 POP_JUMP_IF_TRUE 41 (to 82) 74 RERAISE 2 >> 76 COPY 3 78 POP_EXCEPT 80 RERAISE 1 >> 82 POP_TOP 84 POP_EXCEPT 86 POP_TOP 88 POP_TOP 10 >> 90 LOAD_GLOBAL 1 (print) 92 LOAD_CONST 5 ("OK, now we're done") 94 CALL_NO_KW 1 96 POP_TOP 98 LOAD_CONST 0 (None) 100 RETURN_VALUE 5 >> 102 NOP 10 104 LOAD_GLOBAL 1 (print) 106 LOAD_CONST 5 ("OK, now we're done") 108 CALL_NO_KW 1 110 POP_TOP 112 LOAD_CONST 0 (None) 114 RETURN_VALUE >> 116 PUSH_EXC_INFO 118 LOAD_GLOBAL 1 (print) 120 LOAD_CONST 5 ("OK, now we're done") 122 CALL_NO_KW 1 124 POP_TOP 126 RERAISE 0 >> 128 COPY 3 130 POP_EXCEPT 132 RERAISE 1 ExceptionTable: 4 to 10 -> 14 [0] 12 to 12 -> 116 [0] 14 to 28 -> 36 [1] lasti 30 to 32 -> 116 [0] 34 to 34 -> 36 [1] lasti 36 to 44 -> 116 [0] 46 to 54 -> 68 [1] lasti 56 to 66 -> 116 [0] 68 to 74 -> 76 [3] lasti 76 to 80 -> 116 [0] 82 to 82 -> 76 [3] lasti 84 to 88 -> 116 [0] 116 to 126 -> 128 [1] lastiNew:
1 0 RESUME 0 2 2 NOP 3 4 LOAD_CONST 1 (1) 6 LOAD_CONST 2 (0) 8 BINARY_OP 11 (/) 10 POP_TOP 12 JUMP_FORWARD 14 (to 42) >> 14 PUSH_EXC_INFO 4 16 LOAD_GLOBAL 0 (ZeroDivisionError) 18 JUMP_IF_NOT_EXC_MATCH 17 (to 34) 20 POP_TOP 5 22 LOAD_GLOBAL 1 (print) 24 LOAD_CONST 3 ('Here we go, here we go, here we go...') 26 CALL_NO_KW 1 28 POP_TOP 30 POP_EXCEPT 32 JUMP_FORWARD 35 (to 104) 4 >> 34 RERAISE 0 >> 36 COPY 3 38 POP_EXCEPT 40 RERAISE 1 7 >> 42 LOAD_GLOBAL 2 (i) 44 BEFORE_WITH 46 STORE_FAST 0 (dodgy) 8 48 LOAD_GLOBAL 1 (print) 50 LOAD_CONST 4 ('Never reach this') 52 CALL_NO_KW 1 54 POP_TOP 7 56 LOAD_CONST 0 (None) 58 DUP_TOP 60 DUP_TOP 62 CALL_NO_KW 3 64 POP_TOP 66 JUMP_FORWARD 25 (to 118) >> 68 PUSH_EXC_INFO 70 WITH_EXCEPT_START 72 POP_JUMP_IF_TRUE 41 (to 82) 74 RERAISE 2 >> 76 COPY 3 78 POP_EXCEPT 80 RERAISE 1 >> 82 POP_TOP 84 POP_EXCEPT 86 POP_TOP 88 POP_TOP 90 NOP 10 92 LOAD_GLOBAL 1 (print) 94 LOAD_CONST 5 ("OK, now we're done") 96 CALL_NO_KW 1 98 POP_TOP 100 LOAD_CONST 0 (None) 102 RETURN_VALUE 5 >> 104 NOP 10 106 LOAD_GLOBAL 1 (print) 108 LOAD_CONST 5 ("OK, now we're done") 110 CALL_NO_KW 1 112 POP_TOP 114 LOAD_CONST 0 (None) 116 RETURN_VALUE 7 >> 118 NOP 10 120 LOAD_GLOBAL 1 (print) 122 LOAD_CONST 5 ("OK, now we're done") 124 CALL_NO_KW 1 126 POP_TOP 128 LOAD_CONST 0 (None) 130 RETURN_VALUE >> 132 PUSH_EXC_INFO 134 LOAD_GLOBAL 1 (print) 136 LOAD_CONST 5 ("OK, now we're done") 138 CALL_NO_KW 1 140 POP_TOP 142 RERAISE 0 >> 144 COPY 3 146 POP_EXCEPT 148 RERAISE 1 ExceptionTable: 4 to 10 -> 14 [0] 12 to 12 -> 132 [0] 14 to 28 -> 36 [1] lasti 30 to 32 -> 132 [0] 34 to 34 -> 36 [1] lasti 36 to 44 -> 132 [0] 46 to 54 -> 68 [1] lasti 56 to 66 -> 132 [0] 68 to 74 -> 76 [3] lasti 76 to 80 -> 132 [0] 82 to 82 -> 76 [3] lasti 84 to 88 -> 132 [0] 132 to 142 -> 144 [1] lastiSorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
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.
Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualityMaybe the explicit jump prevents that?
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
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.
Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualityI'm going to assume that this is what happened (this jump prevented an inlining optimization), and remove it as in the first version of this PR. This will being us back to where we were before the except* PR was merged.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
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.
Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualityI think we should probably merge this before the release so that we don’t get a change in behaviour between 3.11a3 and 311.a4.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
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.
Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualityI agree.
This PR merely highlights the excessive duplication of finally blocks. It doesn't cause it.
Do we have an issue to investigate the cause of finally block duplication?
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
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.
Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualityWe do now: link
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.