Cell execution hangs if sys.stderr reassigned with wrapper #16009
Labels
bug
Issue identified by VS Code Team member as probable bug
notebook-kernel
Kernels issues (start/restart/switch/execution, install ipykernel)
user-setup
Issues caused by incorrectly configured python environments, packages, or the like
Applies To
What happened?
If I have the following in a .ipynb notebook opened in VS Code, and I run the following cell, the code executes (got here and got to end both print), but execution never completes, and I need to restart the kernel.
The key line is reassigning
sys.stderr
; all runs fine if I comment this out.I discovered this in trying to figure out what was causing the Python debugger to hang when debugging a cell in Jupyter notebook, which was running jax / equinox code, that overwrites the stderr and causes havoc. If I step through this code in the debugger, the debugger also hangs.
VS Code Version
Version: 1.93.0 Commit: 4849ca9bdf9666755eb463db297b69e5385090e3 Date: 2024-09-04T13:02:38.431Z (2 days ago) Browser: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Code/1.93.0 Chrome/124.0.6367.243 Electron/30.4.0 Safari/537.36
Jupyter Extension Version
v2024.8.0
Jupyter logs
Coding Language and Runtime Version
Python 3.12 in a venv managed by Rye
Language Extension Version (if applicable)
Python v2024.14.0
Anaconda Version (if applicable)
No response
Running Jupyter locally or remotely?
Local
The text was updated successfully, but these errors were encountered: