Skip to content

Commit 885c3d1

Browse files
authored
GH-90916: Add helper function to dis.Instruction and use it to reduce churn in test_dis (GH-130643)
1 parent 63b6ec3 commit 885c3d1

File tree

2 files changed

+224
-208
lines changed

2 files changed

+224
-208
lines changed

Lib/dis.py

+8
Original file line numberDiff line numberDiff line change
@@ -376,6 +376,14 @@ class Instruction(_Instruction):
376376
entries (if any)
377377
"""
378378

379+
@staticmethod
380+
def make(
381+
opname, arg, argval, argrepr, offset, start_offset, starts_line,
382+
line_number, label=None, positions=None, cache_info=None
383+
):
384+
return Instruction(opname, _all_opmap[opname], arg, argval, argrepr, offset,
385+
start_offset, starts_line, line_number, label, positions, cache_info)
386+
379387
@property
380388
def oparg(self):
381389
"""Alias for Instruction.arg."""

0 commit comments

Comments
 (0)