You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-03 08:49:51 +08:00
Merge branch 'python-3.3-to-3.5' into python-2.4
This commit is contained in:
@@ -65,19 +65,19 @@ The node position 0 will be associated with "import".
|
||||
|
||||
import re
|
||||
|
||||
from xdis import iscode, sysinfo2float
|
||||
from uncompyle6.semantics import pysource
|
||||
from uncompyle6 import parser
|
||||
from uncompyle6.scanner import Token, Code, get_scanner
|
||||
import uncompyle6.parser as python_parser
|
||||
from uncompyle6.semantics.check_ast import checker
|
||||
from uncompyle6 import IS_PYPY
|
||||
|
||||
from uncompyle6.show import maybe_show_asm, maybe_show_tree
|
||||
|
||||
from uncompyle6.parsers.treenode import SyntaxTree
|
||||
|
||||
from uncompyle6.semantics.pysource import ParserError, StringIO
|
||||
from xdis import iscode
|
||||
from xdis.version_info import IS_PYPY, PYTHON_VERSION_TRIPLE
|
||||
|
||||
from uncompyle6.semantics.consts import (
|
||||
INDENT_PER_LEVEL,
|
||||
@@ -1176,8 +1176,15 @@ class FragmentsWalker(pysource.SourceWalker, object):
|
||||
self.name = old_name
|
||||
self.return_none = rn
|
||||
|
||||
def build_ast(self, tokens, customize, code, is_lambda=False,
|
||||
noneInNames=False, isTopLevel=False):
|
||||
def build_ast(
|
||||
self,
|
||||
tokens,
|
||||
customize,
|
||||
code,
|
||||
is_lambda=False,
|
||||
noneInNames=False,
|
||||
isTopLevel=False,
|
||||
):
|
||||
|
||||
# FIXME: DRY with pysource.py
|
||||
|
||||
@@ -1196,7 +1203,7 @@ class FragmentsWalker(pysource.SourceWalker, object):
|
||||
p_insts = self.p.insts
|
||||
self.p.insts = self.scanner.insts
|
||||
self.p.offset2inst_index = self.scanner.offset2inst_index
|
||||
ast = python_parser.parse(self.p, tokens, customize)
|
||||
ast = python_parser.parse(self.p, tokens, customize, code)
|
||||
self.p.insts = p_insts
|
||||
except (parser.ParserError(e), AssertionError(e)):
|
||||
raise ParserError(e, tokens)
|
||||
@@ -1741,7 +1748,7 @@ class FragmentsWalker(pysource.SourceWalker, object):
|
||||
prettyprint a list or tuple
|
||||
"""
|
||||
p = self.prec
|
||||
self.prec = 100
|
||||
self.prec = PRECEDENCE["yield"] - 1
|
||||
n = node.pop()
|
||||
lastnode = n.kind
|
||||
start = len(self.f.getvalue())
|
||||
@@ -1821,6 +1828,7 @@ class FragmentsWalker(pysource.SourceWalker, object):
|
||||
fmt = entry[0]
|
||||
arg = 1
|
||||
i = 0
|
||||
|
||||
lastC = -1
|
||||
recurse_node = False
|
||||
|
||||
@@ -2061,7 +2069,9 @@ def code_deparse(
|
||||
assert iscode(co)
|
||||
|
||||
if version is None:
|
||||
version = sysinfo2float()
|
||||
version = PYTHON_VERSION_TRIPLE
|
||||
if is_pypy is None:
|
||||
is_pypy = IS_PYPY
|
||||
|
||||
# store final output stream for case of error
|
||||
scanner = get_scanner(version, is_pypy=is_pypy)
|
||||
|
Reference in New Issue
Block a user