Commit e4ee218
Fix crash in pylsp_definitions on definitions without a source position
When follow_builtin_definitions is True (the default), the return-list
comprehension filter short-circuits
`follow_builtin_defns or _not_internal_definition(d)`, so the None-guards
inside _not_internal_definition never run. A jedi definition that resolves
into a compiled/builtin module has line/column == None, so `d.line - 1`
raises `TypeError: unsupported operand type(s) for -: 'NoneType' and 'int'`.
Exclude definitions with no line/column unconditionally: they cannot form a
valid LSP range regardless of the follow_builtin_definitions setting.
Fixes #623
Fixes #624
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent bc1095f commit e4ee218
2 files changed
Lines changed: 30 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
74 | | - | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
75 | 78 | | |
76 | 79 | | |
77 | 80 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
| 7 | + | |
6 | 8 | | |
7 | 9 | | |
8 | 10 | | |
| |||
173 | 175 | | |
174 | 176 | | |
175 | 177 | | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
0 commit comments