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: Add a setting to disable printing the stack on every Pdb command #153

Merged
merged 4 commits into from
Oct 16, 2019
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
12 changes: 11 additions & 1 deletion spyder_kernels/console/kernel.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ def __init__(self, *args, **kwargs):
'get_namespace_view': self.get_namespace_view,
'set_namespace_view_settings': self.set_namespace_view_settings,
'get_var_properties': self.get_var_properties,
'set_sympy_forecolor': self.set_sympy_forecolor
'set_sympy_forecolor': self.set_sympy_forecolor,
'set_pdb_echo_code': self.set_pdb_echo_code,
}
for call_id in handlers:
self.frontend_comm.register_call_handler(
Expand All @@ -65,6 +66,7 @@ def __init__(self, *args, **kwargs):

self._pdb_obj = None
self._pdb_step = None
self._pdb_print_code = True
self._do_publish_pdb_state = True
self._mpl_backend_error = None

Expand Down Expand Up @@ -103,6 +105,14 @@ def set_spyder_breakpoints(self, breakpoints):
if self._pdb_obj:
self._pdb_obj.set_spyder_breakpoints(breakpoints)

def set_pdb_echo_code(self, state):
"""Set if pdb should echo the code.

This might change for each pdb statment and is therefore not included
in pdb settings.
"""
self._pdb_print_code = state

# -- Public API ---------------------------------------------------
# --- For the Variable Explorer
def set_namespace_view_settings(self, settings):
Expand Down
3 changes: 2 additions & 1 deletion spyder_kernels/customize/spydercustomize.py
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,8 @@ def interaction(self, frame, traceback):
self.setup(frame, traceback)
if self.send_initial_notification:
self.notify_spyder(frame)
self.print_stack_entry(self.stack[self.curindex])
if get_ipython().kernel._pdb_print_code:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add _pdb_print_code to pdb settings

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We decided that this was not necessary because Pdb settings are used to initialize the Pdb instance, but this value can change on every evaluation.

self.print_stack_entry(self.stack[self.curindex])
self._cmdloop()
self.forget()

Expand Down