Skip to content

Commit

Permalink
Decompiler fix for Python 3.6 when operation has EXTENDED_ARGUMENT
Browse files Browse the repository at this point in the history
  • Loading branch information
sashaaero authored and kozlovsky committed Jun 22, 2018
1 parent c2891ba commit d762dc7
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions pony/orm/decompiling.py
Expand Up @@ -79,15 +79,19 @@ def decompile(decompiler):
co_code = code.co_code
free = code.co_cellvars + code.co_freevars
try:
extended_arg = 0
while decompiler.pos < decompiler.end:
i = decompiler.pos
if i in decompiler.targets: decompiler.process_target(i)
op = ord(code.co_code[i])
if PY36:
if op >= HAVE_ARGUMENT:
oparg = ord(co_code[i + 1]) | extended_arg
extended_arg = (arg << 8) if op == EXTENDED_ARG else 0
extended_arg = 0
oparg = ord(code.co_code[i+1])
while op == EXTENDED_ARG:
extended_arg = (extended_arg | oparg) << 8
i += 2
op = ord(code.co_code[i])
oparg = ord(code.co_code[i+1])
oparg = None if op < HAVE_ARGUMENT else oparg | extended_arg
i += 2
else:
i += 1
Expand Down

0 comments on commit d762dc7

Please sign in to comment.