Skip to content

Commit 0efdd87

Browse files
Workaround for Jedi crash when generating function signature.
See: prompt-toolkit#136
1 parent be3d22e commit 0efdd87

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

ptpython/layout.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,14 @@ def get_tokens(cli):
208208

209209
append((Signature.Operator, '('))
210210

211-
for i, p in enumerate(sig.params):
211+
try:
212+
enumerated_params = enumerate(sig.params)
213+
except AttributeError:
214+
# Workaround for #136: https://github.com/jonathanslenders/ptpython/issues/136
215+
# AttributeError: 'Lambda' object has no attribute 'get_subscope_by_name'
216+
return []
217+
218+
for i, p in enumerated_params:
212219
# Workaround for #47: 'p' is None when we hit the '*' in the signature.
213220
# and sig has no 'index' attribute.
214221
# See: https://github.com/jonathanslenders/ptpython/issues/47

0 commit comments

Comments
 (0)