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

Fix pdbpp.Pdb.hidden_frames discrepency with IPython.core.debugger.Pdb.hidden_frames #426

Merged
merged 9 commits into from Nov 22, 2020

Conversation

shwina
Copy link
Contributor

@shwina shwina commented Nov 13, 2020

Opening this PR primarily for discussion. As mentioned in #408, pdbpp doesn't work with IPython anymore, because IPython.core.debugger.Pdb has a hidden_frames method that is at odds with the pdbpp.Pdb.hidden_frames attribute.

Just renaming the attribute in pdbpp fixes the problem but that's probably not a very good solution.

Any suggestions here? Thanks!

@shwina shwina changed the title Fix pdbpp.Pdb.hidden_frames discrepency with IPython.core.debugger.Pdb.hidden_frames Fix pdbpp.Pdb.hidden_frames discrepency with IPython.core.debugger.Pdb.hidden_frames Nov 13, 2020
@blueyed
Copy link
Collaborator

blueyed commented Nov 13, 2020

I think renaming is ok, but I would prefer _hidden_frames then.
Also an (integration) test for this would be good then, but I can look into that myself.
(I imagine having tests that would be run optionally with IPython being installed, and having that installed (optionally?) via a tox factor, which gets used on CI then)

I've used this to reproduce it - is there something simpler?

% ipython
Python 3.8.6 (default, Sep 30 2020, 04:00:38)
Type 'copyright', 'credits' or 'license' for more information
IPython 8.0.0.dev -- An enhanced Interactive Python. Type '?' for help.

In [1]: def foo():
   ...:     raise Exception()
   ...:

In [2]: foo()
---------------------------------------------------------------------------
Exception                                 Traceback (most recent call last)
<ipython-input-2-c19b6d9633cf> in <module>
----> 1 foo()

<ipython-input-1-b10094d32c7e> in foo()
      1 def foo():
----> 2     raise Exception()

Exception:

In [3]: %debug
> <ipython-input-1-b10094d32c7e>(2)foo()
      1 def foo():
----> 2     raise Exception()
      3

ipdb++> up
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-3-bc99e4ec804d> in <module>
----> 1 get_ipython().run_line_magic('debug', '')

...

~/Vcs/ipython/IPython/core/debugger.py in Pdb.do_up(self, arg)
    723 _newindex = self.curindex
    724 counter = 0
--> 725 hidden_frames = self.hidden_frames(self.stack)
    726 for i in range(self.curindex - 1, -1, -1):
    727     frame = self.stack[i][0]

TypeError: 'list' object is not callable

@shwina
Copy link
Contributor Author

shwina commented Nov 13, 2020

I think renaming is ok, but I would prefer _hidden_frames then.

Thanks! I've gone ahead and replaced it with that.

As for the repro, yes - that looks good. If it's useful, here's a slightly more concise repro:

In [1]: %debug raise ValueError()
NOTE: Enter 'c' at the ipdb++>  prompt to continue execution.
> <string>(1)<module>()

ipdb++> u

@blueyed blueyed added the bug label Nov 14, 2020
Copy link
Collaborator

@blueyed blueyed left a comment

Choose a reason for hiding this comment

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

Thanks for this already.
I've hijacked this now a bit to debug an issue with codecov, will merge when that is resolved / being investigated by them.

@shwina
Copy link
Contributor Author

shwina commented Nov 14, 2020

Thank you so much!

@blueyed blueyed merged commit b62a338 into pdbpp:master Nov 22, 2020
@morotti morotti mentioned this pull request Apr 7, 2021
blueyed pushed a commit to blueyed/pdbpp that referenced this pull request May 6, 2021
(based on commit b62a338, but syncs
more with/from master)

Conflicts:
	.travis.yml
	src/pdbpp.py
	testing/test_integration.py
	tox.ini
blueyed added a commit to blueyed/pdbpp that referenced this pull request May 6, 2021
@blueyed blueyed mentioned this pull request May 6, 2021
2 tasks
blueyed added a commit to blueyed/pdbpp that referenced this pull request Jun 12, 2021
blueyed added a commit to blueyed/pdbpp that referenced this pull request Jul 4, 2021
blueyed pushed a commit to blueyed/pdbpp that referenced this pull request Jul 4, 2021
(based on commit b62a338, but syncs
more with/from master)

Conflicts:
	.travis.yml
	src/pdbpp.py
	testing/test_integration.py
	tox.ini

- test_integration: 5904792
blueyed added a commit to blueyed/pdbpp that referenced this pull request Jul 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants