File tree Expand file tree Collapse file tree 2 files changed +7
-1
lines changed
Expand file tree Collapse file tree 2 files changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -564,7 +564,8 @@ def __iter__(self):
564564 co .co_names , co .co_consts ,
565565 self ._linestarts ,
566566 line_offset = self ._line_offset ,
567- exception_entries = self .exception_entries )
567+ exception_entries = self .exception_entries ,
568+ co_positions = co .co_positions ())
568569
569570 def __repr__ (self ):
570571 return "{}({!r})" .format (self .__class__ .__name__ ,
Original file line number Diff line number Diff line change @@ -1302,6 +1302,11 @@ def test_from_traceback_dis(self):
13021302 b = dis .Bytecode .from_traceback (tb )
13031303 self .assertEqual (b .dis (), dis_traceback )
13041304
1305+ @requires_debug_ranges ()
1306+ def test_bytecode_co_positions (self ):
1307+ bytecode = dis .Bytecode ("a=1" )
1308+ for instr , positions in zip (bytecode , bytecode .codeobj .co_positions ()):
1309+ assert instr .positions == positions
13051310
13061311class TestBytecodeTestCase (BytecodeTestCase ):
13071312 def test_assert_not_in_with_op_not_in_bytecode (self ):
You can’t perform that action at this time.
0 commit comments