Skip to content

gh-129098: Skip reading source lines if filename is _pyrepl.__main__.py inside REPL - #129099

Closed
WolframAlph wants to merge 1 commit into
python:mainfrom
WolframAlph:fix-repl
Closed

gh-129098: Skip reading source lines if filename is _pyrepl.__main__.py inside REPL#129099
WolframAlph wants to merge 1 commit into
python:mainfrom
WolframAlph:fix-repl

Conversation

@WolframAlph

@WolframAlphWolframAlph commented Jan 20, 2025

Copy link
Copy Markdown
Contributor

@WolframAlph

WolframAlph commented Jan 20, 2025

Copy link
Copy Markdown
ContributorAuthor

I don't have much context about REPL and not sure this is the correct way to fix this. After spending some time debugging where this comes from, I found out that adding check inside lazycache fixes this issue. Let me know if this is correct way or if this should be done differently.

@WolframAlphWolframAlph changed the title gh-129098: Skip reading source lines if filename is _pyrepl.__main__ inside REPLgh-129098: Skip reading source lines if filename is _pyrepl.__main__.py inside REPLJan 20, 2025
@picnixz

picnixz commented Jan 20, 2025

Copy link
Copy Markdown
Member

I'm not sure we should do it. linecache is independent of the REPL and we shouldn't rely on such checks (maybe the REPL should have its own linecache or something like that? or maybe we should have some better hooking mechanism for it).

Or we could check whether the reported traceback is correct or not (or we could hook compile itself?)

@picnixz

Copy link
Copy Markdown
Member

Let's continue the discussion on the issue itself.

@encukouencukou added the topic-repl Related to the interactive shell label Jan 21, 2025
@WolframAlph
WolframAlph marked this pull request as draft January 23, 2025 15:26
@picnixz

Copy link
Copy Markdown
Member

Closing since it was superseded by #130721.

@picnixzpicnixz closed this Apr 24, 2025
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

topic-replRelated to the interactive shell

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@WolframAlph@picnixz@encukou