Merge branch 'python-3.0-to-3.2' into python-2.4-to-2.7

This commit is contained in:
rocky
2024-12-12 18:07:46 -05:00
9 changed files with 26 additions and 34 deletions

View File

@@ -1,11 +0,0 @@
default_language_version:
python: python
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: check-merge-conflict
- id: debug-statements
stages: [commit]
- id: end-of-file-fixer
stages: [commit]

View File

@@ -1,7 +1,7 @@
#/bin/bash
uncompyle6_merge_33_owd=$(pwd)
uncompyle6_merge_36_owd=$(pwd)
cd $(dirname ${BASH_SOURCE[0]})
if . ./setup-python-3.3.sh; then
if . ./setup-python-3.6.sh; then
git merge master
fi
cd $uncompyle6_merge_33_owd
cd $uncompyle6_merge_36_owd

View File

@@ -17,7 +17,7 @@ cd $mydir
(cd $fulldir/.. && \
setup_version python-spark python-2.4 && \
setup_verseion python-xdis python-2.4-to-2.7)
setup_version python-xdis python-2.4-to-2.7)
checkout_finish python-2.4-to-2.7

Binary file not shown.

Binary file not shown.

View File

@@ -385,6 +385,10 @@ class PythonParser(GenericASTBuilder):
returns ::= return
returns ::= _stmts return
# NOP
stmt ::= nop_stmt
nop_stmt ::= NOP
"""
pass

View File

@@ -17,7 +17,7 @@
import re
from uncompyle6.semantics.consts import INDENT_PER_LEVEL, PRECEDENCE, TABLE_DIRECT
from uncompyle6.semantics.consts import INDENT_PER_LEVEL, PRECEDENCE
from uncompyle6.semantics.helper import flatten_list
# FIXME get from a newer xdis

View File

@@ -86,14 +86,13 @@ else:
from uncompyle6.semantics.consts import (
INDENT_PER_LEVEL,
MAP,
NONE,
PASS,
PRECEDENCE,
TABLE_DIRECT,
TABLE_R,
escape,
)
from uncompyle6.semantics.helper import find_code_node
from uncompyle6.semantics.pysource import (
DEFAULT_DEBUG_OPTS,
TREE_DEFAULT_DEBUG,
@@ -607,17 +606,7 @@ class FragmentsWalker(pysource.SourceWalker, object):
def n_mkfunc(self, node):
start = len(self.f.getvalue())
if self.version >= (3, 3) or node[-2] == "kwargs":
# LOAD_CONST code object ..
# LOAD_CONST 'x0' if >= 3.3
# MAKE_FUNCTION ..
code_node = node[-3]
elif node[-2] == "expr":
code_node = node[-2][0]
else:
# LOAD_CONST code object ..
# MAKE_FUNCTION ..
code_node = node[-2]
code_node = find_code_node(node, -2)
func_name = code_node.attr.co_name
self.write(func_name)
self.set_pos_info(code_node, start, len(self.f.getvalue()))

View File

@@ -1259,11 +1259,20 @@ class SourceWalker(GenericASTTraversal, NonterminalActions, ComprehensionMixin):
if tokens[-1].kind in ("RETURN_VALUE", "RETURN_VALUE_LAMBDA"):
# Python 3.4's classes can add a "return None" which is
# invalid syntax.
if tokens[-2].kind == "LOAD_CONST":
if is_top_level_module or tokens[-2].pattr is None:
del tokens[-2:]
else:
tokens.append(Token("RETURN_LAST"))
load_const = tokens[-2]
# We should have:
# LOAD_CONST None
# with *no* line number associated the token.
# A line number on the token or a non-None
# token value a token based on user source
# text.
if (
load_const.kind == "LOAD_CONST"
and load_const.linestart is None
and load_const.attr is None
):
# Delete LOAD_CONST (None) RETURN_VALUE
del tokens[-2:]
else:
tokens.append(Token("RETURN_LAST"))
if len(tokens) == 0:
@@ -1369,6 +1378,7 @@ def code_deparse(
co,
is_lambda=is_lambda_mode(compile_mode),
is_top_level_module=is_top_level_module,
compile_mode=compile_mode,
)
# XXX workaround for profiling