Skip to content

Commit c265002

Browse files
authored
bpo-40222: Mark exception table function in the dis module as private (#95961)
1 parent 32ac98e commit c265002

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
@@ -394,7 +394,7 @@ def _get_name_info(name_index, get_name, **extrainfo):
394394
else:
395395
return UNKNOWN, ''
396396

397-
def parse_varint(iterator):
397+
def _parse_varint(iterator):
398398
b = next(iterator)
399399
val = b & 63
400400
while b&64:
@@ -403,16 +403,16 @@ def parse_varint(iterator):
403403
val |= b&63
404404
return val
405405

406-
def parse_exception_table(code):
406+
def _parse_exception_table(code):
407407
iterator = iter(code.co_exceptiontable)
408408
entries = []
409409
try:
410410
while True:
411-
start = parse_varint(iterator)*2
412-
length = parse_varint(iterator)*2
411+
start = _parse_varint(iterator)*2
412+
length = _parse_varint(iterator)*2
413413
end = start + length
414-
target = parse_varint(iterator)*2
415-
dl = parse_varint(iterator)
414+
target = _parse_varint(iterator)*2
415+
dl = _parse_varint(iterator)
416416
depth = dl >> 1
417417
lasti = bool(dl&1)
418418
entries.append(_ExceptionTableEntry(start, end, target, depth, lasti))
@@ -527,7 +527,7 @@ def _get_instructions_bytes(code, varname_from_oparg=None,
527527
def disassemble(co, lasti=-1, *, file=None, show_caches=False, adaptive=False):
528528
"""Disassemble a code object."""
529529
linestarts = dict(findlinestarts(co))
530-
exception_entries = parse_exception_table(co)
530+
exception_entries = _parse_exception_table(co)
531531
_disassemble_bytes(_get_code_array(co, adaptive),
532532
lasti, co._varname_from_oparg,
533533
co.co_names, co.co_consts, linestarts, file=file,
@@ -717,7 +717,7 @@ def __init__(self, x, *, first_line=None, current_offset=None, show_caches=False
717717
self._linestarts = dict(findlinestarts(co))
718718
self._original_object = x
719719
self.current_offset = current_offset
720-
self.exception_entries = parse_exception_table(co)
720+
self.exception_entries = _parse_exception_table(co)
721721
self.show_caches = show_caches
722722
self.adaptive = adaptive
723723

0 commit comments

Comments
 (0)