You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Native REPL wrongly caches state from previous session #24359
I'm not sure if I'm missing something, but I cannot find an option to restart the native REPL. If I just close the pane and then send another Python statement (Shift-Enter), it gets executed in the previously started native REPL (i.e., all created object in that session will still be available).
Interesting, I can't seem to repro this.
If you close the REPL tab via clicking on the x icon, It should launch new REPL for you when you try to send command again.
Could you try "Python Clear cache and reload" and see if that helps?
Also make sure it says "Python REPL" on the top right corner.
Here is what happens for me on the latest version of vscode insider and python extension.
No, this does not work for me. When I close the Native REPL tab and run a new command, it opens the previous REPL (in this example, x should not exist in a new REPL, but apparently this is still the same session):
Screen.Recording.2024-11-04.at.15.41.22.mov
When I run "Python: Clear Cache and Reload Window", the native REPL session is indeed closed and a new one is started. However, I don't think this is intended, as the REPL should either close when closing the tab or when selecting a dedicated "Trash" action (which does not exist, but this is how the integrated terminal works, so I think the native REPL should behave similarly).
Activity
anthonykim1 commentedon Oct 31, 2024
Interesting, I can't seem to repro this.
If you close the REPL tab via clicking on the x icon, It should launch new REPL for you when you try to send command again.
Could you try "Python Clear cache and reload" and see if that helps?
Also make sure it says "Python REPL" on the top right corner.
Here is what happens for me on the latest version of vscode insider and python extension.
Screen.Recording.2024-10-31.at.2.13.40.PM.mov
cbrnr commentedon Nov 4, 2024
No, this does not work for me. When I close the Native REPL tab and run a new command, it opens the previous REPL (in this example,
xshould not exist in a new REPL, but apparently this is still the same session):Screen.Recording.2024-11-04.at.15.41.22.mov
When I run "Python: Clear Cache and Reload Window", the native REPL session is indeed closed and a new one is started. However, I don't think this is intended, as the REPL should either close when closing the tab or when selecting a dedicated "Trash" action (which does not exist, but this is how the integrated terminal works, so I think the native REPL should behave similarly).
[-]Add option to restart native REPL[/-][+]Native REPL wrongly caches state from previous session[/+]anthonykim1 commentedon Dec 10, 2024
Hey Clemens Brunner (@cbrnr) Thanks for this, you are 100% correct.
Will make sure this eventually gets resolved, I think this is very important.
hutch3232 commentedon Feb 19, 2025
I would love for this issue to be solved. I tried looking into it but haven't yet figured it out. I don't know typescript so it is tricky for me.
I feel like in here:
vscode-python/src/client/repl/nativeRepl.ts
Lines 70 to 80 in 42962ce
we need to run:
That way, in
getNativeReplit will create a new REPL.But that on its own is not sufficient. After closing the REPL, sending new code throws:
notebook controller with id 'pythonREPL' ALREADY existThere is a
setReplControllermethod maybe we need anunsetReplControlleror something that gets called as well.With a bit of guidance I could look more into this. Thanks!
Closes microsoft#24359
anthonykim1 commentedon Mar 8, 2025
Sorry, just saw this Paul (@hutch3232)
Will take a look at the referenced PR and leave feedback there.
Thanks very much for looking into this!
prevent native REPL from caching state between sessions (microsoft#24857