Add flag to tolerate deparse errors...

and keep going. The fragment parser should ignore errors
in nested function definitions
This commit is contained in:
rocky
2017-11-04 12:29:27 -04:00
parent 6746e5167d
commit 4f0a668b7c
3 changed files with 18 additions and 9 deletions

View File

@@ -166,7 +166,7 @@ class SourceWalker(GenericASTTraversal, object):
def __init__(self, version, out, scanner, showast=False,
debug_parser=PARSER_DEFAULT_DEBUG,
compile_mode='exec', is_pypy=False,
linestarts={}):
linestarts={}, tolerate_errors=False):
"""version is the Python version (a float) of the Python dialect
of both the AST and language we should produce.
@@ -214,6 +214,10 @@ class SourceWalker(GenericASTTraversal, object):
self.line_number = 0
self.ast_errors = []
# Sometimes we may want to continue decompiling when there are errors
# and sometimes not
self.tolerate_errors = tolerate_errors
# hide_internal suppresses displaying the additional instructions that sometimes
# exist in code but but were not written in the source code.
# An example is: