Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PR: Check if the iopub channel is not closed before flushing it (IPython console) #20749

Merged
merged 2 commits into from
Mar 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions external-deps/qtconsole/.gitrepo

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions external-deps/qtconsole/qtconsole/client.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions external-deps/qtconsole/qtconsole/frontend_widget.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 19 additions & 2 deletions spyder/plugins/ipythonconsole/widgets/debugging.py
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,16 @@ def reset(self, clear=False):
# Make sure the prompt is printed
if clear and self.is_waiting_pdb_input():
prompt, password = self._pdb_prompt
self.kernel_client.iopub_channel.flush()

try:
# This is necessary to avoid an error when the iopub channel is
# closed.
# See jupyter/qtconsole#574
if not self.kernel_client.iopub_channel.closed():
self.kernel_client.iopub_channel.flush()
except AttributeError:
self.kernel_client.iopub_channel.flush()

self._reading = False
self._readline(prompt=prompt, callback=self._pdb_readline_callback,
password=password)
Expand Down Expand Up @@ -631,7 +640,15 @@ def pdb_input(self, prompt, password=None):
if print_prompt:
# Make sure that all output from the SUB channel has been processed
# before writing a new prompt.
self.kernel_client.iopub_channel.flush()
try:
# This is necessary to avoid an error when the iopub channel is
# closed.
# See jupyter/qtconsole#574
if not self.kernel_client.iopub_channel.closed():
self.kernel_client.iopub_channel.flush()
except AttributeError:
self.kernel_client.iopub_channel.flush()

self._waiting_pdb_input = True
self._readline(prompt=prompt, callback=self._pdb_readline_callback,
password=password)
Expand Down