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):
564
564
co .co_names , co .co_consts ,
565
565
self ._linestarts ,
566
566
line_offset = self ._line_offset ,
567
- exception_entries = self .exception_entries )
567
+ exception_entries = self .exception_entries ,
568
+ co_positions = co .co_positions ())
568
569
569
570
def __repr__ (self ):
570
571
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):
1302
1302
b = dis .Bytecode .from_traceback (tb )
1303
1303
self .assertEqual (b .dis (), dis_traceback )
1304
1304
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
1305
1310
1306
1311
class TestBytecodeTestCase (BytecodeTestCase ):
1307
1312
def test_assert_not_in_with_op_not_in_bytecode (self ):
You can’t perform that action at this time.
0 commit comments