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

Breakpoint must be set on first line to debug using Python 3.10 on Windows #841

Closed
kycutler opened this issue Jan 13, 2022 · 5 comments · Fixed by ipython/ipython#13535
Closed

Comments

@kycutler
Copy link
Contributor

Steps to Reproduce (see GIF below):

  • Set up a Python 3.10 environment on Windows (Linux untested) with latest IPyKernel and Jupyter Lab
    • e.g. with Anaconda: conda create -y -c conda-forge -n jlab310 jupyterlab python>=3.10
  • Start JLab and open a notebook connected to the IPyKernel debugger
  • Add more than one line of code to a cell, and try setting breakpoints on any line except the first one.
  • Notice that the breakpoints do not get hit when running the cell.
  • Now try setting a breakpoint on the first line and notice that breakpoints again work as expected.

jlab310breakpoints

I can do that same setup with the same package versions in Python 3.9 and breakpoints work normally. I'm not positive this is a problem with IPyKernel, but debugging a normal Python file with debugpy still works fine so this is my best guess.

Also in the GIF above you can ignore the fact that the current line is not highlighted in the cell -- that is due to #784 and seems to be unrelated.

@rchiodo
Copy link

rchiodo commented Feb 10, 2022

I think this is a debugpy/pydevd issue. The breakpoint request goes through and is verified by the debugger, it just never fires the stop event.

See this issue here:
microsoft/debugpy#844

@rchiodo
Copy link

rchiodo commented Feb 25, 2022

I don't think this is fixed quite yet. Using the latest IPython 8.1.0 and putting a breakpoint on the first line of a cell, step into will keep jumping back to the first line.

I opened this issue on debugpy:
microsoft/debugpy#854

@fabioz
Copy link

fabioz commented Feb 26, 2022

This happens because in Python 3.10 there is always a line event at line 1 and Python itself is making that line event due to the way it's compiled now.

It seems my fix wasn't complete then... This will need another fix in IPython so that besides the new co_name the co_lnotab is also redone so that this spurious line event isn't done.

@fabioz
Copy link

fabioz commented Feb 26, 2022

It seems my fix wasn't complete then... This will need another fix in IPython so that besides the new co_name the co_lnotab is also redone so that this spurious line event isn't done.

Actually, I was able to fix this in the debugger itself (so, changes to IPython aren't needed here).

clrpackages pushed a commit to clearlinux-pkgs/pypi-ipython that referenced this issue Mar 1, 2022
…ion 8.1.0

Adam Johnson (1):
      Revert "enable formatting by default"

Alexander Steppke (3):
      Allow autosuggestions to be configurable.
      Add configurable providers for autosuggestions
      Remove empty line for linter

Anton Älgmyr (3):
      Add support for autoformatting using yapf
      Fix some formatting
      Fix darker complaint, even though inconsistent

Can Sarigol (1):
      Get history file from shell to debugger if it exists.

David Lowry-Duda (1):
      Require pygments>=2.4.0

Eric Prestat (1):
      Fix display import in .core.display

Fabio Zadrozny (1):
      Set co_name for cells run line by line. Fixes ipython/ipykernel#841

Gal B (2):
      Add missing auto_match flag in shortcuts.py
      Run linter on cve.py

Jan-Hendrik Müller (2):
      added second example
      remove blank lines

Jason Grout (2):
      Light editing of 8.0 what's new
      Add a link to 8.0 milestone

Jochen Ott (1):
      Add fallback for utils.ShimModule.__repr__

Jonathan Allen Grant (1):
      Typo

Kai Tetzlaff (moka.tetzco.de) (1):
      fix function references for get_ipython_dir and locate_profile

Karthikeyan Singaravelan (1):
      Fix typo

Lucy McPhail (1):
      Improve auto_match for quotes

Matthias Bussonnier (34):
      Fix and test for "async with does not allow new lines".
      xfail pypy
      back to dev
      Add title to fix doc build
      disable latex
      Create SECURITY.md
      Narrow down test running on branches.
      autoformat
      remove/deduplicate tests with u-prefix
      apply pyupgrade
      Update docs/source/whatsnew/version8.rst
      Update IPython/terminal/interactiveshell.py
      FIX CVE-2022-21699
      Add test for CVE-2022-21699
      link to gh advisory
      reformat
      Readd xfail to help with debian packaging
      try to fix app-veyor
      pin pytest
      Update old deprecation
      Make unicode backslach completion fuzzy and case insensitive
      Allow to configure lazy loadable magics.
      MAINT: deprecate append_to_syspath
      MAINT: cleanup imports of tempdir.
      doc parssing issue
      formatting
      reformatting
      Remove IPython/lib/security.
      Update some deprecated ip.magic() to run_line-magic in tests
      Try to avoid network connection during tests.
      Whats new 7.32
      wn 8
      Increase test coverage
      release 8.1.0

Nate Rush (4):
      utils/tests: move to pytest.mark.parameterize in test_text.py
      utils/tests: move to pytest.mark.parameterize in test_process.py
      utils/tests: move to pytest.mark.parameterize in test_path.py
      utils/tests: fix quotes in test_text.py

Nathan Buckner (2):
      Fix for symlink resolving
      Removed chdir and changed to joining the path if not absolute path.

Nicholas Bollweg (3):
      move, sort (black) extras to setup.cfg, pygments pin
      move all lower
      fix pygments name

Nikita Kniazev (3):
      ipdoctest: Merge upstream changes to pytest doctest plugin
      ipdoctest: pytest<7 compatibility
      unpin pytest

Samuel B. Johnson (1):
      🐛 Remove `ls` from list of system commands to warn about

Samuel Lelièvre (1):
      Sync `latex_symbols.jl` url in two places

Smart (1):
      fix typo

Thomas Nicholas (1):
      match only pseudo-decorators

Waylon Walker (1):
      correct version8.rst typos

fcasal (1):
      Fix typo in docs.

gousaiyang (3):
      Fix EncodingWarning on Python 3.10
      Format code
      IPython currently incompatible with pytest 7

ltrujello (1):
      Fixes #13472 by restoring user's terminal cursor

luz paz (1):
      Fix various typos

martinRenou (5):
      Pin black in CI
      Update sphinxify usage
      Update IPython/core/interactiveshell.py
      Update IPython/core/interactiveshell.py
      Update IPython/core/interactiveshell.py

ygeyzel (1):
      Typing '%' restrict autocompletion to magics
@rchiodo
Copy link

rchiodo commented Mar 24, 2022

Just verified latest release of debugpy fixes this. 👏

jdtsmith added a commit to jdtsmith/ipython that referenced this issue Mar 28, 2022
MrMino pushed a commit to ipython/ipython that referenced this issue Jun 16, 2022
* Implement lineno's for Input mapped files
* Adopt In [123], line 123 format
* Revert "Set co_name for cells run line by line. Fixes ipython/ipykernel#841"
  (This reverts commit d11e987.)
* Omit mention of ", in <module>" for input tracebacks
* Input cell -> Cell
* Remove <module> from traceback doctests
* Use f-string for `in ...' format
* Simplify _format_list logic, converting to f-strings
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 a pull request may close this issue.

3 participants