Skip to content

Commit 8c3143c

Browse files
committed
Sync with decompyle3
1 parent 0a08b8d commit 8c3143c

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

uncompyle6/semantics/pysource.py

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@
134134
from typing import Optional
135135

136136
from spark_parser import GenericASTTraversal
137-
from xdis import COMPILER_FLAG_BIT, iscode
137+
from xdis import COMPILER_FLAG_BIT, IS_PYPY, iscode
138138
from xdis.version_info import PYTHON_VERSION_TRIPLE
139139

140140
from uncompyle6.parser import get_python_parser, parse
@@ -149,6 +149,7 @@
149149
MAP,
150150
MAP_DIRECT,
151151
NAME_MODULE,
152+
NO_PARENTHESIS_EVER,
152153
NONE,
153154
PASS,
154155
PRECEDENCE,
@@ -189,8 +190,6 @@ def unicode(x):
189190
"dups": False,
190191
}
191192

192-
IS_PYPY = "__pypy__" in sys.builtin_module_names
193-
194193
TREE_DEFAULT_DEBUG = {"before": False, "after": False}
195194

196195
DEFAULT_DEBUG_OPTS = {
@@ -210,7 +209,7 @@ def __str__(self):
210209

211210
class SourceWalker(GenericASTTraversal, NonterminalActions, ComprehensionMixin):
212211
"""
213-
Class to traverses a Parse Tree of the bytecode instruction built from parsing to
212+
Class to traverse a Parse Tree of the bytecode instruction built from parsing to
214213
produce some sort of source text.
215214
The Parse tree may be turned an Abstract Syntax tree as an intermediate step.
216215
"""
@@ -267,27 +266,32 @@ def __init__(
267266
is_pypy=is_pypy,
268267
)
269268

269+
self.ERROR = None
270270
self.ast_errors = []
271-
self.currentclass = None
272271
self.classes = []
272+
self.compile_mode = compile_mode
273+
self.currentclass = None
273274
self.debug_parser = dict(debug_parser)
274-
self.line_number = 1
275+
self.is_pypy = is_pypy
275276
self.linemap = {}
276-
self.params = params
277+
self.line_number = 1
278+
self.linestarts = linestarts
279+
self.mod_globs = set()
280+
self.name = None
281+
self.offset2inst_index = scanner.offset2inst_index
277282
self.param_stack = []
278-
self.ERROR = None
279-
self.prec = 100
283+
self.params = params
284+
self.pending_newlines = 0
285+
self.prec = NO_PARENTHESIS_EVER
280286
self.return_none = False
281-
self.mod_globs = set()
282287
self.showast = showast
283-
self.pending_newlines = 0
284-
self.linestarts = linestarts
288+
self.version = version
289+
285290
self.treeTransform = TreeTransform(version=self.version, show_ast=showast)
286291

287292
# FIXME: have p.insts update in a better way
288293
# modularity is broken here
289294
self.insts = scanner.insts
290-
self.offset2inst_index = scanner.offset2inst_index
291295

292296
# Initialize p_lambda on demand
293297
self.p_lambda = None
@@ -312,10 +316,6 @@ def __init__(
312316
# An example is:
313317
# __module__ = __name__
314318
self.hide_internal = True
315-
self.compile_mode = compile_mode
316-
self.name = None
317-
self.version = version
318-
self.is_pypy = is_pypy
319319
customize_for_version(self, is_pypy, version)
320320
return
321321

0 commit comments

Comments
 (0)