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

Allow interrupting input() on Windows, as part of effort to make pdb interruptible #498

Merged
merged 10 commits into from
May 20, 2020

Conversation

itamarst
Copy link
Contributor

@itamarst itamarst commented Apr 1, 2020

This is part of the solution to ipython/ipython#10516.

@itamarst
Copy link
Contributor Author

itamarst commented Apr 3, 2020

Not sure what's up with failure on Travis, unless I did something wrong I also get them on master too.

@itamarst itamarst changed the title Allow interrupting input() on Windows Allow interrupting input() on Windows, as part of effort to make pdb interruptible Apr 23, 2020
@itamarst
Copy link
Contributor Author

@Carreau @blink1073 any chance someone could look at this? Lack of pdb interruption seems to hit a lot of Jupyter users. Thank you!

Copy link
Contributor

@blink1073 blink1073 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 taking this on!

# doing a blocking recv() means stdin reads are uninterruptible
# on Windows:
if (ident, reply) == (None, None):
time.sleep(0.001)
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm wary of spin loops like this; since it is a socket we can use select().

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Unfortunately select() is also uninterruptible by KeyboardInterrupt on Windows. I decided to try using it anyway, because that way at least the loop will be more responsive while needing to wake up less. But sadly as far as I can tell this needs a loop of some sort if it's going to be uninterruptible 😞

Copy link
Contributor

Choose a reason for hiding this comment

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

Shucks, thanks for looking into it. I'm not sure what happened on the last travis build, I kicked it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I tried matplotlib 3.2.1 on my Linux machine and can't reproduce those issues. But on newer version of Python.

Copy link
Contributor

Choose a reason for hiding this comment

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

IPython 7.14.0 was released 4 days ago, that might be it.

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm using same version of matplotlib as Travis, though. With updated ipython still can't reproduce... Can you try rerunning tests on master? At least that way can tell if it's in any way related to this PR.

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

...and that failed in the same way

Copy link
Contributor

Choose a reason for hiding this comment

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

one thing to try is pinning the ipython version to 7.13.0

@blink1073 blink1073 added this to the 5.3 milestone May 20, 2020
Copy link
Contributor

@blink1073 blink1073 left a comment

Choose a reason for hiding this comment

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

Thanks!

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.

2 participants