Show More
@@ -11,6 +11,7 b' from codeop import compile_command' | |||
|
11 | 11 | import re |
|
12 | 12 | import tokenize |
|
13 | 13 | from typing import List, Tuple |
|
14 | import warnings | |
|
14 | 15 | |
|
15 | 16 | _indent_re = re.compile(r'^[ \t]+') |
|
16 | 17 | |
@@ -536,7 +537,9 b' class TransformerManager:' | |||
|
536 | 537 | # We'll use codeop.compile_command to check this with the real parser. |
|
537 | 538 | |
|
538 | 539 | try: |
|
539 | res = compile_command(''.join(lines), symbol='exec') | |
|
540 | with warnings.catch_warnings(): | |
|
541 | warnings.simplefilter('error', SyntaxWarning) | |
|
542 | res = compile_command(''.join(lines), symbol='exec') | |
|
540 | 543 | except (SyntaxError, OverflowError, ValueError, TypeError, |
|
541 | 544 | MemoryError, SyntaxWarning): |
|
542 | 545 | return 'invalid', None |
General Comments 0
You need to be logged in to leave comments.
Login now