Skip to content

Commit 38882d9

Browse files
bpo-40222: Mark exception table function in the dis module as private (GH-95961)
(cherry picked from commit c265002) Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
1 parent d89f5fe commit 38882d9

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

Lib/dis.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,7 @@ def _get_name_info(name_index, get_name, **extrainfo):
392392
else:
393393
return UNKNOWN, ''
394394

395-
def parse_varint(iterator):
395+
def _parse_varint(iterator):
396396
b = next(iterator)
397397
val = b & 63
398398
while b&64:
@@ -401,16 +401,16 @@ def parse_varint(iterator):
401401
val |= b&63
402402
return val
403403

404-
def parse_exception_table(code):
404+
def _parse_exception_table(code):
405405
iterator = iter(code.co_exceptiontable)
406406
entries = []
407407
try:
408408
while True:
409-
start = parse_varint(iterator)*2
410-
length = parse_varint(iterator)*2
409+
start = _parse_varint(iterator)*2
410+
length = _parse_varint(iterator)*2
411411
end = start + length
412-
target = parse_varint(iterator)*2
413-
dl = parse_varint(iterator)
412+
target = _parse_varint(iterator)*2
413+
dl = _parse_varint(iterator)
414414
depth = dl >> 1
415415
lasti = bool(dl&1)
416416
entries.append(_ExceptionTableEntry(start, end, target, depth, lasti))
@@ -519,7 +519,7 @@ def _get_instructions_bytes(code, varname_from_oparg=None,
519519
def disassemble(co, lasti=-1, *, file=None, show_caches=False, adaptive=False):
520520
"""Disassemble a code object."""
521521
linestarts = dict(findlinestarts(co))
522-
exception_entries = parse_exception_table(co)
522+
exception_entries = _parse_exception_table(co)
523523
_disassemble_bytes(_get_code_array(co, adaptive),
524524
lasti, co._varname_from_oparg,
525525
co.co_names, co.co_consts, linestarts, file=file,
@@ -706,7 +706,7 @@ def __init__(self, x, *, first_line=None, current_offset=None, show_caches=False
706706
self._linestarts = dict(findlinestarts(co))
707707
self._original_object = x
708708
self.current_offset = current_offset
709-
self.exception_entries = parse_exception_table(co)
709+
self.exception_entries = _parse_exception_table(co)
710710
self.show_caches = show_caches
711711
self.adaptive = adaptive
712712

0 commit comments

Comments
 (0)