GH-90916: Add helper function to dis.Instruction and use it to reduce churn in test_dis (GH-130643)

This commit is contained in:
Mark Shannon 2025-03-04 16:43:39 +00:00 committed by GitHub
parent 63b6ec31c4
commit 885c3d126f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 224 additions and 208 deletions

View file

@ -376,6 +376,14 @@ class Instruction(_Instruction):
entries (if any)
"""
@staticmethod
def make(
opname, arg, argval, argrepr, offset, start_offset, starts_line,
line_number, label=None, positions=None, cache_info=None
):
return Instruction(opname, _all_opmap[opname], arg, argval, argrepr, offset,
start_offset, starts_line, line_number, label, positions, cache_info)
@property
def oparg(self):
"""Alias for Instruction.arg."""