Skip to content

Commit 117aaa0

Browse files
authored
Merge branch 'main' into suppress-file-completion-enh
2 parents 4c02531 + cd483f2 commit 117aaa0

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

IPython/core/completer.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1352,6 +1352,8 @@ def _trim_expr(self, code: str) -> str:
13521352
assert res is not None
13531353
if len(res.body) != 1:
13541354
continue
1355+
if not isinstance(res.body[0], ast.Expr):
1356+
continue
13551357
expr = res.body[0].value
13561358
if isinstance(expr, ast.Tuple) and not code[-1] == ")":
13571359
# we skip implicit tuple, like when trimming `fun(a,b`<completion>

tests/test_completer.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2696,6 +2696,7 @@ def test_misc_no_jedi_completions(setup, code, expected, not_expected):
26962696
("x = {1, y", "y"),
26972697
("x = [1, y", "y"),
26982698
("x = fun(1, y", "y"),
2699+
(" assert a", "a"),
26992700
],
27002701
)
27012702
def test_trim_expr(code, expected):

0 commit comments

Comments
 (0)