ipdb stops showing prompt text after carriage return
Asked Answered
R

1

14

Recently when setting up a breakpoint using ipdb.set_trace(context=20) I can see the command I'm inputing the first time, after hitting return, next time I write an instruction or command in my ipdb prompt is not showing. When I hit enter it executes it and shows it in the previous lines.

This wasn't happening until very recently. I'm using mac, with iterm, latest ipdb and pytest.

EDIT 2022-3-29

  • I've been trying to play with the shell settings, disconnect ozsh, antigen plugins, to see it was related, but doesn't seem to affect.

  • I've also tried with terminal, instead of iterm.

  • Here is a recording of what I'm describing: enter image description here

EDIT 2022-3-31

  • I've realized this only happens with one of my projects
  • The prompt disappears after an exception occurs no matter which type, otherwise it always works fine.
  • After the exception prompt starts failing, but sometimes it's not in the first command after
  • I've written a simple python program to run with the same setup and it doesn't happen, so there's something else messing with this

EDIT 2022-3-31 (2.0)

  • After spending some time playing with this, I discovered this was only happening in some tests, the ones decorated with freezegun

I'm using freezegun 1.2.1 and pytest 6.2.5. When I run this code if I execute print a couple times, cursor disappears. This is the most basic reproduction test I've been able to come up with.

import ipdb
from freezegun import freeze_time
    
    
@freeze_time("2022-3-12")
def test_prompt_ipdb():
    ipdb.set_trace()
    
test_prompt_ipdb()

I now believe this a bug in one of these two, most likely freezegun doing something fancy.

Rubenrubens answered 23/3, 2022 at 9:37 Comment(4)
Yes, but I don't see what I'm typing while I type, only after I press carriage returnRubenrubens
Having the exact same issue - also on a test that's been freeze-gunned :(Turmel
Hey! any news on this issue? I'm also having it while running freezegun (v1.2.1) with ipdb (v0.13.9) and pytest (v7.1.2)Dracula
Yes this is weird! Only with ipdb though… pdb works fine. And only on a freezegun test.Algo
H
7

This doesn't seem like a bug in ipdb (nor in IPython for that matter, with which this reproduces as well). The problem is between freezegun and prompt-toolkit, which IPython (and consequently ipdb) rely on. I'm hoping they will accept this PR, but until then this behavior can be resolved by adding prompt_toolkit to the ignore-list using the extend_ignore_list argument, like so:

import ipdb
import freezegun

freezegun.configure(extend_ignore_list=['prompt_toolkit'])

@freezegun.freeze_time("2022-3-12")
def test_prompt_ipdb():
    ipdb.set_trace()

test_prompt_ipdb()
Hamachi answered 17/11, 2022 at 7:27 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.