You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-04 01:09:52 +08:00
Merge branch 'master' into python-2.4
This commit is contained in:
@@ -240,7 +240,7 @@ be solved if one were to put in the time to do so. The problem is that
|
||||
there aren't that many people who have been working on bug fixing.
|
||||
|
||||
Some of the bugs in 3.7 and 3.8 are simply a matter of back-porting
|
||||
the fixes in decmopyle3.
|
||||
the fixes in decompyle3.
|
||||
|
||||
You may run across a bug, that you want to report. Please do so. But
|
||||
be aware that it might not get my attention for a while. If you
|
||||
|
BIN
test/bytecode_2.6_run/01_lambda_call.pyc
Normal file
BIN
test/bytecode_2.6_run/01_lambda_call.pyc
Normal file
Binary file not shown.
BIN
test/bytecode_2.7_run/01_lambda_call.pyc
Normal file
BIN
test/bytecode_2.7_run/01_lambda_call.pyc
Normal file
Binary file not shown.
BIN
test/bytecode_3.7_run/01_lambda_call.pyc
Normal file
BIN
test/bytecode_3.7_run/01_lambda_call.pyc
Normal file
Binary file not shown.
BIN
test/bytecode_3.8_run/01_lambda_call.pyc
Normal file
BIN
test/bytecode_3.8_run/01_lambda_call.pyc
Normal file
Binary file not shown.
4
test/simple_source/bug22/01_lambda_call.py
Normal file
4
test/simple_source/bug22/01_lambda_call.py
Normal file
@@ -0,0 +1,4 @@
|
||||
# From https://github.com/rocky/python-uncompyle6/issues/350
|
||||
# This is RUNNABLE!
|
||||
a = (lambda x: x)(abs)
|
||||
assert a(-3) == 3
|
@@ -1,5 +1,5 @@
|
||||
# Python 3.3 pyclbr.py
|
||||
# Note that Python 3 adds a lot of unecessary "continues"
|
||||
# Note that Python 3 adds a lot of unnecessary "continues"
|
||||
# and puts that in for "pass"
|
||||
def _readmodule(g, token, path):
|
||||
for tokentype in g:
|
||||
|
@@ -221,7 +221,7 @@ def main_bin():
|
||||
if f is None:
|
||||
break
|
||||
(t, o, f, v) = \
|
||||
main(src_base, out_base, [f], None, outfile, **options)
|
||||
main(src_base, out_base, [f], [], outfile, **options)
|
||||
tot_files += t
|
||||
okay_files += o
|
||||
failed_files += f
|
||||
|
@@ -317,7 +317,7 @@ class Python2Parser(PythonParser):
|
||||
build_count = token.attr
|
||||
thousands = build_count // 1024
|
||||
thirty32s = (build_count // 32) % 32
|
||||
if thirty32s > 0:
|
||||
if thirty32s > 0 or thousands > 0:
|
||||
rule = "expr32 ::=%s" % (" expr" * 32)
|
||||
self.add_unique_rule(rule, opname_base, build_count, customize)
|
||||
if thousands > 0:
|
||||
|
@@ -846,7 +846,7 @@ class Python3Parser(PythonParser):
|
||||
build_count = token.attr
|
||||
thousands = build_count // 1024
|
||||
thirty32s = (build_count // 32) % 32
|
||||
if thirty32s > 0:
|
||||
if thirty32s > 0 or thousands > 0:
|
||||
rule = "expr32 ::=%s" % (" expr" * 32)
|
||||
self.add_unique_rule(rule, opname_base, build_count, customize)
|
||||
pass
|
||||
|
@@ -1,4 +1,4 @@
|
||||
# Copyright (c) 2019-2020 by Rocky Bernstein
|
||||
# Copyright (c) 2019-2021 by Rocky Bernstein
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@@ -275,11 +275,16 @@ def customize_for_version37(self, version):
|
||||
and opname == "CALL_FUNCTION_1"
|
||||
or not re.match(r"\d", opname[-1])
|
||||
):
|
||||
if node[0][0] == "_mklambda":
|
||||
template = "(%c)(%p)"
|
||||
else:
|
||||
template = "%c(%p)"
|
||||
self.template_engine(
|
||||
("%c(%p)",
|
||||
(template,
|
||||
(0, "expr"),
|
||||
(1, PRECEDENCE["yield"]-1)),
|
||||
node)
|
||||
node
|
||||
)
|
||||
self.prec = p
|
||||
self.prune()
|
||||
else:
|
||||
|
@@ -414,19 +414,23 @@ class TreeTransform(GenericASTTraversal, object):
|
||||
prev = node[0][0]
|
||||
new_stmts = [node[0]]
|
||||
for i, sstmt in enumerate(node[1:]):
|
||||
ann_assign = sstmt[0][0]
|
||||
ann_assign = sstmt[0]
|
||||
if (
|
||||
sstmt[0] == "stmt"
|
||||
and ann_assign == "ann_assign"
|
||||
ann_assign == "ann_assign"
|
||||
and prev == "assign"
|
||||
):
|
||||
annotate_var = ann_assign[-2]
|
||||
if annotate_var.attr == prev[-1][0].attr:
|
||||
node[i].kind = "deleted " + node[i].kind
|
||||
del new_stmts[-1]
|
||||
sstmt[0][0] = SyntaxTree(
|
||||
"ann_assign_init", [ann_assign[0], prev[0], annotate_var]
|
||||
ann_assign_init = SyntaxTree(
|
||||
"ann_assign_init", [ann_assign[0], copy(prev[0]), annotate_var]
|
||||
)
|
||||
sstmt[0][0].transformed_by = "n_stmts"
|
||||
if sstmt[0] == "ann_assign":
|
||||
sstmt[0] = ann_assign_init
|
||||
else:
|
||||
sstmt[0][0] = ann_assing_init
|
||||
sstmt[0].transformed_by = "n_stmts"
|
||||
pass
|
||||
pass
|
||||
new_stmts.append(sstmt)
|
||||
|
@@ -10,6 +10,7 @@
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# This file is suitable for sourcing inside POSIX shell as
|
||||
# well as importing into Python
|
||||
__version__="3.7.4" # noqa
|
||||
|
Reference in New Issue
Block a user