Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions Lib/test/test_dis.py
Original file line number Diff line number Diff line change
Expand Up @@ -1209,8 +1209,13 @@ def test_loop_quicken(self):
got = self.get_disassembly(loop_test, adaptive=True)
expected = dis_loop_test_quickened_code
if _testinternalcapi.get_optimizer():
# We *may* see ENTER_EXECUTOR in the disassembly
got = got.replace("ENTER_EXECUTOR", "JUMP_BACKWARD ")
# We *may* see ENTER_EXECUTOR in the disassembly. This is a
# temporary hack to keep the test working until dis is able to
# handle the instruction correctly (GH-112383):
got = got.replace(
"ENTER_EXECUTOR 16",
"JUMP_BACKWARD 16 (to L1)",
Comment on lines +1216 to +1217
Copy link
Member

Choose a reason for hiding this comment

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

We really need an API on executor objects so you can access the vm_data field. We the API to get the executors should be an (unstable) method on PyCodeObject, not a function in _testinternalcapi.

Copy link
Member Author

Choose a reason for hiding this comment

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

Do we need it though? Given the code object, we can always recover the original opcode and oparg using co_code (instead of _co_code_adaptive, which gives us the executor and index).

Copy link
Member

Choose a reason for hiding this comment

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

Ah, that works too. I guess my main point was that we shouldn't blindly assume ENTER_EXECUTOR sits on top of JUMP_BACKWARD. Although that is currently the case (and will still be so if/when my side-exits PR lands).

)
self.do_disassembly_compare(got, expected)

@cpython_only
Expand Down