mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
GH-99944: Make dis display the value of oparg of KW_NAMES (#103856)
Co-authored-by: chilaxan <chilaxan@gmail.com>
This commit is contained in:
parent
1461a22f91
commit
d45225bd66
3 changed files with 27 additions and 3 deletions
|
@ -227,6 +227,26 @@ dis_bug46724 = """\
|
|||
JUMP_FORWARD -4 (to 0)
|
||||
"""
|
||||
|
||||
def func_w_kwargs(a, b, **c):
|
||||
pass
|
||||
|
||||
def wrap_func_w_kwargs():
|
||||
func_w_kwargs(1, 2, c=5)
|
||||
|
||||
dis_kw_names = """\
|
||||
%3d RESUME 0
|
||||
|
||||
%3d LOAD_GLOBAL 1 (NULL + func_w_kwargs)
|
||||
LOAD_CONST 1 (1)
|
||||
LOAD_CONST 2 (2)
|
||||
LOAD_CONST 3 (5)
|
||||
KW_NAMES 4 (('c',))
|
||||
CALL 3
|
||||
POP_TOP
|
||||
RETURN_CONST 0 (None)
|
||||
""" % (wrap_func_w_kwargs.__code__.co_firstlineno,
|
||||
wrap_func_w_kwargs.__code__.co_firstlineno + 1)
|
||||
|
||||
_BIG_LINENO_FORMAT = """\
|
||||
1 RESUME 0
|
||||
|
||||
|
@ -911,6 +931,10 @@ class DisTests(DisTestBase):
|
|||
# Test that negative operargs are handled properly
|
||||
self.do_disassembly_test(bug46724, dis_bug46724)
|
||||
|
||||
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_big_linenos(self):
|
||||
def func(count):
|
||||
namespace = {}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue