diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2022-08-14 15:08:04 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-14 15:08:04 (GMT) |
commit | 38882d97b35c667ac3d937d82b3d024698e4396a (patch) | |
tree | 9aefd1e7b556d6b637db8bc202b269643df3530b | |
parent | d89f5fe1f4ee630a83196a7a7bf5a03a81036bb5 (diff) | |
download | cpython-38882d97b35c667ac3d937d82b3d024698e4396a.zip cpython-38882d97b35c667ac3d937d82b3d024698e4396a.tar.gz cpython-38882d97b35c667ac3d937d82b3d024698e4396a.tar.bz2 |
bpo-40222: Mark exception table function in the dis module as private (GH-95961)
(cherry picked from commit c26500224fe80559d1aa4973f22453c9ce2130ab)
Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
-rw-r--r-- | Lib/dis.py | 16 |
1 files changed, 8 insertions, 8 deletions
@@ -392,7 +392,7 @@ def _get_name_info(name_index, get_name, **extrainfo): else: return UNKNOWN, '' -def parse_varint(iterator): +def _parse_varint(iterator): b = next(iterator) val = b & 63 while b&64: @@ -401,16 +401,16 @@ def parse_varint(iterator): val |= b&63 return val -def parse_exception_table(code): +def _parse_exception_table(code): iterator = iter(code.co_exceptiontable) entries = [] try: while True: - start = parse_varint(iterator)*2 - length = parse_varint(iterator)*2 + start = _parse_varint(iterator)*2 + length = _parse_varint(iterator)*2 end = start + length - target = parse_varint(iterator)*2 - dl = parse_varint(iterator) + target = _parse_varint(iterator)*2 + dl = _parse_varint(iterator) depth = dl >> 1 lasti = bool(dl&1) entries.append(_ExceptionTableEntry(start, end, target, depth, lasti)) @@ -519,7 +519,7 @@ def _get_instructions_bytes(code, varname_from_oparg=None, def disassemble(co, lasti=-1, *, file=None, show_caches=False, adaptive=False): """Disassemble a code object.""" linestarts = dict(findlinestarts(co)) - exception_entries = parse_exception_table(co) + exception_entries = _parse_exception_table(co) _disassemble_bytes(_get_code_array(co, adaptive), lasti, co._varname_from_oparg, co.co_names, co.co_consts, linestarts, file=file, @@ -706,7 +706,7 @@ class Bytecode: self._linestarts = dict(findlinestarts(co)) self._original_object = x self.current_offset = current_offset - self.exception_entries = parse_exception_table(co) + self.exception_entries = _parse_exception_table(co) self.show_caches = show_caches self.adaptive = adaptive |