You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-04 09:22:40 +08:00
Fix 3.6 MAKE_FUNCTION for kw params...
and remove duplicated attributies in pattr of MAKE_FUNCITON token.
This commit is contained in:
Binary file not shown.
@@ -1,3 +1,8 @@
|
|||||||
# From 3.6 base64.py. Bug was handling *, and keyword args
|
# From 3.6 base64.py. Bug was handling *, and keyword args
|
||||||
def a85decode(b, *, foldspaces=False, adobe=False, ignorechars=b' \t\n\r\v'):
|
def a85decode(b, *, foldspaces=False, adobe=False, ignorechars=b' \t\n\r\v'):
|
||||||
return
|
return
|
||||||
|
|
||||||
|
# From 3.6 configparser.py. Same problem as above.
|
||||||
|
_UNSET = object()
|
||||||
|
def get(self, section, option, *, raw=False, vars=None, fallback=_UNSET):
|
||||||
|
return
|
||||||
|
@@ -354,11 +354,6 @@ class Scanner3(Scanner):
|
|||||||
attr = []
|
attr = []
|
||||||
for flag in self.MAKE_FUNCTION_FLAGS:
|
for flag in self.MAKE_FUNCTION_FLAGS:
|
||||||
bit = flags & 1
|
bit = flags & 1
|
||||||
if bit:
|
|
||||||
if pattr:
|
|
||||||
pattr += ", " + flag
|
|
||||||
else:
|
|
||||||
pattr += flag
|
|
||||||
attr.append(bit)
|
attr.append(bit)
|
||||||
flags >>= 1
|
flags >>= 1
|
||||||
attr = attr[:4] # remove last value: attr[5] == False
|
attr = attr[:4] # remove last value: attr[5] == False
|
||||||
|
@@ -17,7 +17,6 @@
|
|||||||
|
|
||||||
import re, sys
|
import re, sys
|
||||||
from uncompyle6 import PYTHON3
|
from uncompyle6 import PYTHON3
|
||||||
from xdis.bytecode import op_has_argument
|
|
||||||
|
|
||||||
if PYTHON3:
|
if PYTHON3:
|
||||||
intern = sys.intern
|
intern = sys.intern
|
||||||
|
@@ -625,19 +625,22 @@ def make_function3(self, node, is_lambda, nested=1, codeNode=None):
|
|||||||
# kwonlyargcount = co.co_kwonlyargcount
|
# kwonlyargcount = co.co_kwonlyargcount
|
||||||
|
|
||||||
free_tup = annotate_dict = kw_dict = default_tup = None
|
free_tup = annotate_dict = kw_dict = default_tup = None
|
||||||
index = 0
|
fn_bits = node[-1].attr
|
||||||
# FIXME: this is woefully wrong
|
index = -4 # Skip over:
|
||||||
if argc & 8:
|
# MAKE_FUNCTION,
|
||||||
|
# LOAD_CONST qualified name,
|
||||||
|
# LOAD_CONST code object
|
||||||
|
if fn_bits[-1]:
|
||||||
free_tup = node[index]
|
free_tup = node[index]
|
||||||
index += 1
|
index -= 1
|
||||||
if argc & 4:
|
if fn_bits[-2]:
|
||||||
kw_dict = node[1]
|
annotate_dict = node[index]
|
||||||
index += 1
|
index -= 1
|
||||||
if argc & 2:
|
if fn_bits[-3]:
|
||||||
kw_dict = node[index]
|
|
||||||
index += 1
|
|
||||||
if argc & 1:
|
|
||||||
kw_dict = node[index]
|
kw_dict = node[index]
|
||||||
|
index -= 1
|
||||||
|
if fn_bits[-4]:
|
||||||
|
default_tup = node[index]
|
||||||
|
|
||||||
if kw_dict == 'expr':
|
if kw_dict == 'expr':
|
||||||
kw_dict = kw_dict[0]
|
kw_dict = kw_dict[0]
|
||||||
@@ -645,10 +648,6 @@ def make_function3(self, node, is_lambda, nested=1, codeNode=None):
|
|||||||
# FIXME: handle free_tup, annotate_dict, and default_tup
|
# FIXME: handle free_tup, annotate_dict, and default_tup
|
||||||
if kw_dict:
|
if kw_dict:
|
||||||
assert kw_dict == 'dict'
|
assert kw_dict == 'dict'
|
||||||
# try:
|
|
||||||
# assert kw_dict == 'dict'
|
|
||||||
# except:
|
|
||||||
# from trepan.api import debug; debug()
|
|
||||||
defaults = [self.traverse(n, indent='') for n in kw_dict[:-2]]
|
defaults = [self.traverse(n, indent='') for n in kw_dict[:-2]]
|
||||||
names = eval(self.traverse(kw_dict[-2]))
|
names = eval(self.traverse(kw_dict[-2]))
|
||||||
assert len(defaults) == len(names)
|
assert len(defaults) == len(names)
|
||||||
|
Reference in New Issue
Block a user