Skip to content

Fix TypeError when get_line_code called on literals - #2104

Open
clayote wants to merge 2 commits into
davidhalter:masterfrom
clayote:get_line_code
Open

Fix TypeError when get_line_code called on literals#2104
clayote wants to merge 2 commits into
davidhalter:masterfrom
clayote:get_line_code

Conversation

@clayote

@clayote clayote commented Aug 2, 2026

Copy link
Copy Markdown

Calling this method on literals usually takes you to standard library code, tightly wrapping the underlying C. Not very useful most of the time, but a logical thing to ask for.

Jedi should have the ability.

The lack of it caused an error in emacs' anaconda-mode when attempting to inspect the name of a literal value.

clayote added 2 commits August 2, 2026 13:23
Calling this method on literals usually takes you to standard library code,
tightly wrapping the underlying C.
Not very useful most of the time,
but a logical thing to ask for.
Jedi should have the ability.
@davidhalter

Copy link
Copy Markdown
Owner

But the question here is: Why does this happen? This might just be a bug in a different place. Catching AttributeErrors like this is almost always a bad idea unless we actually know what's going on and then a comment should probably describe that.

@davidhalter

Copy link
Copy Markdown
Owner

Also you are changing name here, which is an absolute no-go whenever you encounter python code. There should never be side effects from anywhere so random.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants