mirror of
https://github.com/xonsh/xonsh.git
synced 2025-03-04 16:34:47 +01:00
Merge pull request #609 from gforsyth/multiline_fix
help `compile` not lose its mind
This commit is contained in:
commit
bd964ce552
1 changed files with 2 additions and 0 deletions
|
@ -21,6 +21,8 @@ class TabShouldInsertIndentFilter(Filter):
|
||||||
|
|
||||||
def can_compile(src):
|
def can_compile(src):
|
||||||
"""Returns whether the code can be compiled, i.e. it is valid xonsh."""
|
"""Returns whether the code can be compiled, i.e. it is valid xonsh."""
|
||||||
|
if not src.endswith('\n') and not src.endswith('\''):
|
||||||
|
src = src + '\n'
|
||||||
try:
|
try:
|
||||||
builtins.__xonsh_execer__.compile(src, mode='single', glbs=None,
|
builtins.__xonsh_execer__.compile(src, mode='single', glbs=None,
|
||||||
locs=builtins.__xonsh_ctx__)
|
locs=builtins.__xonsh_ctx__)
|
||||||
|
|
Loading…
Add table
Reference in a new issue