diff --git a/Lib/dis.py b/Lib/dis.py --- a/Lib/dis.py +++ b/Lib/dis.py @@ -370,22 +370,26 @@ def findlabels(code): Return the list of offsets. """ labels = [] # enumerate() is not an option, since we sometimes process # multiple elements on a single pass through the loop n = len(code) i = 0 + extended_arg = 0 while i < n: op = code[i] i = i+1 if op >= HAVE_ARGUMENT: - arg = code[i] + code[i+1]*256 + arg = code[i] + code[i+1]*256 + extended_arg + extended_arg = 0 i = i+2 + if op == EXTENDED_ARG: + extended_arg = arg*65536 label = -1 if op in hasjrel: label = i+arg elif op in hasjabs: label = arg if label >= 0: if label not in labels: labels.append(label)