You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-02 16:44:46 +08:00
Merge branch 'python-3.3-to-3.5' into python-3.0-to-3.2
This commit is contained in:
@@ -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]
|
@@ -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
|
||||
|
@@ -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
|
||||
|
BIN
test/bytecode_2.7/06_nop.pyc
Normal file
BIN
test/bytecode_2.7/06_nop.pyc
Normal file
Binary file not shown.
BIN
test/bytecode_3.6/06_nop.pyc
Normal file
BIN
test/bytecode_3.6/06_nop.pyc
Normal file
Binary file not shown.
@@ -391,6 +391,10 @@ class PythonParser(GenericASTBuilder):
|
||||
|
||||
returns ::= return
|
||||
returns ::= _stmts return
|
||||
|
||||
# NOP
|
||||
stmt ::= nop_stmt
|
||||
nop_stmt ::= NOP
|
||||
|
||||
"""
|
||||
pass
|
||||
|
@@ -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
|
||||
|
@@ -1216,6 +1216,7 @@ class SourceWalker(GenericASTTraversal, NonterminalActions, ComprehensionMixin):
|
||||
is_lambda=False,
|
||||
noneInNames=False,
|
||||
is_top_level_module=False,
|
||||
compile_mode="exec",
|
||||
) -> GenericASTTraversal:
|
||||
# FIXME: DRY with fragments.py
|
||||
|
||||
@@ -1255,11 +1256,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:
|
||||
@@ -1365,6 +1375,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
|
||||
|
Reference in New Issue
Block a user