| Index: tools/telemetry/third_party/coverage/coverage/bytecode.py
|
| diff --git a/third_party/pycoverage/coverage/bytecode.py b/tools/telemetry/third_party/coverage/coverage/bytecode.py
|
| similarity index 77%
|
| copy from third_party/pycoverage/coverage/bytecode.py
|
| copy to tools/telemetry/third_party/coverage/coverage/bytecode.py
|
| index 85360638528e6bece33b1f5a1e4dd08e5c2ac3d0..82929cef8a7b980a6d33512d83e67392fddac087 100644
|
| --- a/third_party/pycoverage/coverage/bytecode.py
|
| +++ b/tools/telemetry/third_party/coverage/coverage/bytecode.py
|
| @@ -1,9 +1,14 @@
|
| +# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0
|
| +# For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt
|
| +
|
| """Bytecode manipulation for coverage.py"""
|
|
|
| -import opcode, types
|
| +import opcode
|
| +import types
|
|
|
| from coverage.backward import byte_to_int
|
|
|
| +
|
| class ByteCode(object):
|
| """A single bytecode."""
|
| def __init__(self):
|
| @@ -26,10 +31,12 @@ class ByteCode(object):
|
| class ByteCodes(object):
|
| """Iterator over byte codes in `code`.
|
|
|
| + This handles the logic of EXTENDED_ARG byte codes internally. Those byte
|
| + codes are not returned by this iterator.
|
| +
|
| Returns `ByteCode` objects.
|
|
|
| """
|
| - # pylint: disable=R0924
|
| def __init__(self, code):
|
| self.code = code
|
|
|
| @@ -38,6 +45,7 @@ class ByteCodes(object):
|
|
|
| def __iter__(self):
|
| offset = 0
|
| + ext_arg = 0
|
| while offset < len(self.code):
|
| bc = ByteCode()
|
| bc.op = self[offset]
|
| @@ -45,7 +53,7 @@ class ByteCodes(object):
|
|
|
| next_offset = offset+1
|
| if bc.op >= opcode.HAVE_ARGUMENT:
|
| - bc.arg = self[offset+1] + 256*self[offset+2]
|
| + bc.arg = ext_arg + self[offset+1] + 256*self[offset+2]
|
| next_offset += 2
|
|
|
| label = -1
|
| @@ -56,7 +64,11 @@ class ByteCodes(object):
|
| bc.jump_to = label
|
|
|
| bc.next_offset = offset = next_offset
|
| - yield bc
|
| + if bc.op == opcode.EXTENDED_ARG:
|
| + ext_arg = bc.arg * 256*256
|
| + else:
|
| + ext_arg = 0
|
| + yield bc
|
|
|
|
|
| class CodeObjects(object):
|
|
|