Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

gh-134210: handle signals in_curses.window.getch#134326

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
picnixz wants to merge3 commits intopython:main
base:main
Choose a base branch
Loading
frompicnixz:fix/curses/getch-signals-134210

Conversation

picnixz
Copy link
Member

@picnixzpicnixz commentedMay 20, 2025
edited by bedevere-appbot
Loading

@vstinner
Copy link
Member

vstinner commentedMay 20, 2025
edited
Loading

I tried this change with the script:

fromcursesimportwrapperimportctypesdefmain(window):window.nodelay(True)returnwindow.getch()print(wrapper(main))

Before (without this change), it displays-1.

After (with this change), it fails with the exception:_curses.error: wgetch() (called by getch()): no input.

So this change is backward incompatible. Is it deliberate?

@picnixz
Copy link
MemberAuthor

picnixz commentedMay 20, 2025
edited
Loading

Hum. No it's not meant to be broken!

Only the signals should be handled, but otherwise we shouldn't raise an exception.

@picnixz
Copy link
MemberAuthor

picnixz commentedMay 20, 2025
edited
Loading

Now I am bit conflicted. Ideally, we should return -1 for everythingor raise an exception as in the other functions. I don't know why it was historically chosen to return -1 forgetch but not forget_wch in no-delay mode.

However, since I don't want to break stuff, I don't know how we can make a smooth transition, except by raising a warning before returning -1.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

2 participants
@picnixz@vstinner

[8]ページ先頭

©2009-2025 Movatter.jp