Merge branch 'master' into python-2.4

This commit is contained in:
rocky
2021-06-15 22:47:45 -04:00
13 changed files with 29 additions and 15 deletions

View File

@@ -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. 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 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 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 be aware that it might not get my attention for a while. If you

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View 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

View File

@@ -1,5 +1,5 @@
# Python 3.3 pyclbr.py # 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" # and puts that in for "pass"
def _readmodule(g, token, path): def _readmodule(g, token, path):
for tokentype in g: for tokentype in g:

View File

@@ -221,7 +221,7 @@ def main_bin():
if f is None: if f is None:
break break
(t, o, f, v) = \ (t, o, f, v) = \
main(src_base, out_base, [f], None, outfile, **options) main(src_base, out_base, [f], [], outfile, **options)
tot_files += t tot_files += t
okay_files += o okay_files += o
failed_files += f failed_files += f

View File

@@ -317,7 +317,7 @@ class Python2Parser(PythonParser):
build_count = token.attr build_count = token.attr
thousands = build_count // 1024 thousands = build_count // 1024
thirty32s = (build_count // 32) % 32 thirty32s = (build_count // 32) % 32
if thirty32s > 0: if thirty32s > 0 or thousands > 0:
rule = "expr32 ::=%s" % (" expr" * 32) rule = "expr32 ::=%s" % (" expr" * 32)
self.add_unique_rule(rule, opname_base, build_count, customize) self.add_unique_rule(rule, opname_base, build_count, customize)
if thousands > 0: if thousands > 0:

View File

@@ -846,7 +846,7 @@ class Python3Parser(PythonParser):
build_count = token.attr build_count = token.attr
thousands = build_count // 1024 thousands = build_count // 1024
thirty32s = (build_count // 32) % 32 thirty32s = (build_count // 32) % 32
if thirty32s > 0: if thirty32s > 0 or thousands > 0:
rule = "expr32 ::=%s" % (" expr" * 32) rule = "expr32 ::=%s" % (" expr" * 32)
self.add_unique_rule(rule, opname_base, build_count, customize) self.add_unique_rule(rule, opname_base, build_count, customize)
pass pass

View File

@@ -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 # 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 # 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" and opname == "CALL_FUNCTION_1"
or not re.match(r"\d", opname[-1]) or not re.match(r"\d", opname[-1])
): ):
if node[0][0] == "_mklambda":
template = "(%c)(%p)"
else:
template = "%c(%p)"
self.template_engine( self.template_engine(
("%c(%p)", (template,
(0, "expr"), (0, "expr"),
(1, PRECEDENCE["yield"]-1)), (1, PRECEDENCE["yield"]-1)),
node) node
)
self.prec = p self.prec = p
self.prune() self.prune()
else: else:

View File

@@ -414,19 +414,23 @@ class TreeTransform(GenericASTTraversal, object):
prev = node[0][0] prev = node[0][0]
new_stmts = [node[0]] new_stmts = [node[0]]
for i, sstmt in enumerate(node[1:]): for i, sstmt in enumerate(node[1:]):
ann_assign = sstmt[0][0] ann_assign = sstmt[0]
if ( if (
sstmt[0] == "stmt" ann_assign == "ann_assign"
and ann_assign == "ann_assign"
and prev == "assign" and prev == "assign"
): ):
annotate_var = ann_assign[-2] annotate_var = ann_assign[-2]
if annotate_var.attr == prev[-1][0].attr: if annotate_var.attr == prev[-1][0].attr:
node[i].kind = "deleted " + node[i].kind
del new_stmts[-1] del new_stmts[-1]
sstmt[0][0] = SyntaxTree( ann_assign_init = SyntaxTree(
"ann_assign_init", [ann_assign[0], prev[0], annotate_var] "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
pass pass
new_stmts.append(sstmt) new_stmts.append(sstmt)

View File

@@ -10,6 +10,7 @@
# #
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# This file is suitable for sourcing inside POSIX shell as # This file is suitable for sourcing inside POSIX shell as
# well as importing into Python # well as importing into Python
__version__="3.7.4" # noqa __version__="3.7.4" # noqa