You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-03 00:45:53 +08:00
changes from other branches
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
# Copyright (c) 2015-2021 by Rocky Bernstein
|
||||
# Copyright (c) 2015-2021 2024 by Rocky Bernstein
|
||||
# Copyright (c) 2000-2002 by hartmut Goebel <h.goebel@crazy-compilers.com>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
@@ -17,20 +17,17 @@
|
||||
All the crazy things we have to do to handle Python functions in Python before 3.0.
|
||||
The saga of changes continues in 3.0 and above and in other files.
|
||||
"""
|
||||
from xdis import code_has_star_arg, code_has_star_star_arg, iscode
|
||||
|
||||
from uncompyle6.scanner import Code
|
||||
from uncompyle6.semantics.parser_error import ParserError
|
||||
from uncompyle6.parser import ParserError as ParserError2
|
||||
from uncompyle6.semantics.helper import (
|
||||
print_docstring,
|
||||
find_all_globals,
|
||||
find_globals_and_nonlocals,
|
||||
find_none,
|
||||
print_docstring,
|
||||
)
|
||||
from xdis import iscode, code_has_star_arg, code_has_star_star_arg
|
||||
from uncompyle6.semantics.parser_error import ParserError
|
||||
|
||||
from itertools import zip_longest
|
||||
|
||||
from uncompyle6.show import maybe_show_tree_param_default
|
||||
|
||||
def make_function2(self, node, is_lambda, nested=1, code_node=None):
|
||||
"""
|
||||
@@ -40,8 +37,8 @@ def make_function2(self, node, is_lambda, nested=1, code_node=None):
|
||||
|
||||
def build_param(ast, name, default):
|
||||
"""build parameters:
|
||||
- handle defaults
|
||||
- handle format tuple parameters
|
||||
- handle defaults
|
||||
- handle format tuple parameters
|
||||
"""
|
||||
# if formal parameter is a tuple, the paramater name
|
||||
# starts with a dot (eg. '.1', '.2')
|
||||
@@ -52,7 +49,6 @@ def make_function2(self, node, is_lambda, nested=1, code_node=None):
|
||||
|
||||
if default:
|
||||
value = self.traverse(default, indent="")
|
||||
maybe_show_tree_param_default(self.showast, name, value)
|
||||
result = "%s=%s" % (name, value)
|
||||
if result[-2:] == "= ": # default was 'LOAD_CONST None'
|
||||
result += "None"
|
||||
@@ -199,5 +195,5 @@ def make_function2(self, node, is_lambda, nested=1, code_node=None):
|
||||
ast, code.co_name, code._customize, is_lambda=is_lambda, returnNone=rn
|
||||
)
|
||||
|
||||
code._tokens = None # save memory
|
||||
code._tokens = None # save memory
|
||||
code._customize = None # save memory
|
||||
|
@@ -337,7 +337,6 @@ def make_function3(self, node, is_lambda, nested=1, code_node=None):
|
||||
- handle format tuple parameters
|
||||
"""
|
||||
value = self.traverse(default, indent="")
|
||||
maybe_show_tree_param_default(self.showast, name, value)
|
||||
if annotation:
|
||||
result = "%s: %s=%s" % (name, annotation, value)
|
||||
else:
|
||||
|
@@ -278,7 +278,7 @@ class NonterminalActions:
|
||||
elif elem.optype == "const" and not isinstance(elem.attr, str):
|
||||
value = elem.attr
|
||||
else:
|
||||
value = "%s" % repr(elem.pattr)
|
||||
value = "%s" % repr(elem.attr)
|
||||
else:
|
||||
assert elem.kind == "ADD_VALUE_VAR"
|
||||
value = "%s" % elem.pattr
|
||||
|
Reference in New Issue
Block a user