-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
Conversation
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) |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
PS: pytest-dev/pytest#1712 seems on its way in. nose2 seems to directly call the |
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... |
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).
ef175ff
to
ec2d023
Compare
5.1 it will be then. |
Ok, let's merge this one. |
- `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
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 befairly trivially replaced by
IPython.core.debugger.Pdb().set_trace()
(we can let
Pdb
catchBdbQuit
itself).It may be also possible to make
color_scheme
a kw-only arg toPdb
, 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).