You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-03 00:45:53 +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
|
||||
def a85decode(b, *, foldspaces=False, adobe=False, ignorechars=b' \t\n\r\v'):
|
||||
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 = []
|
||||
for flag in self.MAKE_FUNCTION_FLAGS:
|
||||
bit = flags & 1
|
||||
if bit:
|
||||
if pattr:
|
||||
pattr += ", " + flag
|
||||
else:
|
||||
pattr += flag
|
||||
attr.append(bit)
|
||||
flags >>= 1
|
||||
attr = attr[:4] # remove last value: attr[5] == False
|
||||
|
@@ -17,7 +17,6 @@
|
||||
|
||||
import re, sys
|
||||
from uncompyle6 import PYTHON3
|
||||
from xdis.bytecode import op_has_argument
|
||||
|
||||
if PYTHON3:
|
||||
intern = sys.intern
|
||||
|
@@ -625,19 +625,22 @@ def make_function3(self, node, is_lambda, nested=1, codeNode=None):
|
||||
# kwonlyargcount = co.co_kwonlyargcount
|
||||
|
||||
free_tup = annotate_dict = kw_dict = default_tup = None
|
||||
index = 0
|
||||
# FIXME: this is woefully wrong
|
||||
if argc & 8:
|
||||
fn_bits = node[-1].attr
|
||||
index = -4 # Skip over:
|
||||
# MAKE_FUNCTION,
|
||||
# LOAD_CONST qualified name,
|
||||
# LOAD_CONST code object
|
||||
if fn_bits[-1]:
|
||||
free_tup = node[index]
|
||||
index += 1
|
||||
if argc & 4:
|
||||
kw_dict = node[1]
|
||||
index += 1
|
||||
if argc & 2:
|
||||
kw_dict = node[index]
|
||||
index += 1
|
||||
if argc & 1:
|
||||
index -= 1
|
||||
if fn_bits[-2]:
|
||||
annotate_dict = node[index]
|
||||
index -= 1
|
||||
if fn_bits[-3]:
|
||||
kw_dict = node[index]
|
||||
index -= 1
|
||||
if fn_bits[-4]:
|
||||
default_tup = node[index]
|
||||
|
||||
if kw_dict == 'expr':
|
||||
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
|
||||
if kw_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]]
|
||||
names = eval(self.traverse(kw_dict[-2]))
|
||||
assert len(defaults) == len(names)
|
||||
|
Reference in New Issue
Block a user