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

Simplify debugger classes. #9731

Merged
merged 1 commit into from
Jul 19, 2016
Merged

Conversation

anntzer
Copy link
Contributor

@anntzer anntzer commented Jul 10, 2016

Directly get the color scheme from the interactive shell (which is
created if not already present, anyways). The goal is ultimately to
allow the IPython debugger to be a drop-in replacement of the stdlib pdb
with the same signature (in particular, this would obviate the need for
plugins such as nose-ipdb and pytest-ipdb; nose and pytest could instead
let their --pdb command line arg take an argument specifying the Pdb
(sub)class to use, e.g. py.test --pdb=IPython.core.debugger.Pdb).

Also deprecate the Tracer class (and related utilities), which can be
fairly trivially replaced by IPython.core.debugger.Pdb().set_trace()
(we can let Pdb catch BdbQuit itself).

It may be also possible to make color_scheme a kw-only arg to Pdb, but it would be awkward to do so while maintaining back-compatibility (because it is used positionally and as the first argument in a few places). So another option would be to break back-compatibility without a deprecation period, and directly make it a kw-only arg in IPython 6 (this is trivial to do in a Py3-only codebase).

@Carreau
Copy link
Member

Carreau commented Jul 12, 2016

Great ! Thanks !

I don't think we'll do that in the 5.x branch but as soon as we release 5.1 and for master toward a 6.0 I'll be happy to get things like that in !

Unless @takluyver thinks the deprecation messages in 5.1 are worth it.

Thoughts ?

@@ -62,6 +63,7 @@ def BdbQuit_excepthook(et, ev, tb, excepthook=None):
All other exceptions are processed using the `excepthook`
parameter.
"""
warnings.warn("`BdbQuit_excepthook` is deprecated", DeprecationWarning)
Copy link
Member

Choose a reason for hiding this comment

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

Nitpicking, but once we agree on when to deprecate (5.1 or 6.0), I like to add ...deprecated since version X.y otherwise it's painful for user to figure out when they can remove potential shims , and for us to figure out when we can delete the 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.

Added deprecation as of 5.1 following @takluyver's comment.

@anntzer
Copy link
Contributor Author

anntzer commented Jul 12, 2016

PS: pytest-dev/pytest#1712 seems on its way in. nose2 seems to directly call the pdb API (instead of instantiating a Pdb instance) so it would require a bit deeper refactoring.

@takluyver
Copy link
Member

I kind of think that the colour stuff should be in the terminal subclass. But that would remove coloured output from debugging in Jupyter frontends, so probably not...

@takluyver
Copy link
Member

I think I'd be OK with this going in for 5.1, but I don't feel strongly either way.

Directly get the color scheme from the interactive shell (which is
created if not already present, anyways).  The goal is ultimately to
allow the IPython debugger to be a drop-in replacement of the stdlib pdb
with the same signature (in particular, this would obviate the need for
plugins such as nose-ipdb and pytest-ipdb; nose and pytest could instead
let their `--pdb` command line arg take an argument specifying the Pdb
(sub)class to use, e.g. `py.test --pdb=IPython.core.debugger.Pdb`).

Also deprecate the `Tracer` class (and related utilities), which can be
fairly trivially replaced by `IPython.core.debugger.Pdb().set_trace()`
(we can let `Pdb` catch `BdbQuit` itself).
@Carreau Carreau added this to the 5.1 milestone Jul 12, 2016
@Carreau
Copy link
Member

Carreau commented Jul 12, 2016

5.1 it will be then.

@Carreau
Copy link
Member

Carreau commented Jul 19, 2016

Ok, let's merge this one.

@Carreau Carreau merged commit eece8e8 into ipython:master Jul 19, 2016
@anntzer anntzer deleted the simplify-debugger branch July 19, 2016 23:11
telamonian added a commit to telamonian/ipython that referenced this pull request May 3, 2022
- `BdbQuit` is now handled in the top-most scope of `InteractiveShell.run_code`. This ensures that `BdbQuit` is correctly handled but can still do its job of breaking out of all user code/loops/further breakpoint requests. Hopefully will work better than previous attempts, which put the `BdqQuit` handling in `Pdb.set_trace`

- fixes:
  - jupyterlab/jupyterlab#12501

- refs:
  - ipython#876
  - ipython#1273
  - ipython#4474
  - ipython#5306
  - ipython#9731
  - ipython#9942
  - ipython#9950
  - ipython#10006
  - ipython#12378
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants