Skip to content
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Add single test for 3 CALL_INTRINSIC_1 codes and update one existing …
…test
  • Loading branch information
jkchandalia committed Apr 30, 2023
commit 0ecf7f57ce45f1462300e471d63fc8be48fd336d
37 changes: 36 additions & 1 deletion Lib/test/test_dis.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,35 @@ def wrap_func_w_kwargs():
""" % (wrap_func_w_kwargs.__code__.co_firstlineno,
wrap_func_w_kwargs.__code__.co_firstlineno + 1)

dis_intrinsic_1_2 = """\
0 RESUME 0

1 LOAD_CONST 0 (0)
LOAD_CONST 1 (('*',))
IMPORT_NAME 0 (math)
CALL_INTRINSIC_1 2 (INTRINSIC_IMPORT_STAR)
POP_TOP
RETURN_CONST 2 (None)
"""

dis_intrinsic_1_5 = """\
0 RESUME 0

1 LOAD_NAME 0 (a)
CALL_INTRINSIC_1 5 (INTRINSIC_UNARY_POSITIVE)
RETURN_VALUE
"""

dis_intrinsic_1_6 = """\
0 RESUME 0

1 BUILD_LIST 0
LOAD_NAME 0 (a)
LIST_EXTEND 1
CALL_INTRINSIC_1 6 (INTRINSIC_LIST_TO_TUPLE)
RETURN_VALUE
"""

_BIG_LINENO_FORMAT = """\
1 RESUME 0

Expand Down Expand Up @@ -549,7 +578,7 @@ async def _asyncwith(c):
>> COPY 3
POP_EXCEPT
RERAISE 1
>> CALL_INTRINSIC_1 3
>> CALL_INTRINSIC_1 3 (INTRINSIC_STOPITERATION_ERROR)
RERAISE 1
ExceptionTable:
12 rows
Expand Down Expand Up @@ -942,6 +971,12 @@ def test_kw_names(self):
# Test that value is displayed for KW_NAMES
self.do_disassembly_test(wrap_func_w_kwargs, dis_kw_names)

def test_intrinsic_1(self):
# Test that argrepr is displayed for CALL_INTRINSIC_1
self.do_disassembly_test('from math import *', dis_intrinsic_1_2)
self.do_disassembly_test('+a', dis_intrinsic_1_5)
self.do_disassembly_test('(*a,)', dis_intrinsic_1_6)

def test_big_linenos(self):
def func(count):
namespace = {}
Expand Down