Message184709
| Author |
vstinner |
| Recipients |
Julian, vstinner |
| Date |
2013年03月19日.23:54:50 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1363737290.89.0.0912247789208.issue16293@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
The following example returns immediatly, whereas I expected it to block. So I consider that ungetch(-1) should fail, but I may be wrong.
---
import curses
def test_screen(screen):
screen.nodelay(True)
key = screen.getch()
screen.nodelay(False)
curses.ungetch(key)
screen.getch()
curses.wrapper(test_screen)
---
key is -1, I don't get an OverflowError. The Python implementation of ungetch() casts the Python int to a C "chtype" type, and check for underflow or overflow. On my Fedora 18, chtype is defined in ncurses.h as "unsigned long". My code checking for overflow doesn't detect the overflow for this specific case.
What is your platform (name and version)?
We should always have the same behaviour on any platform (always fail with an error, or always accept -1), so anyway there is a bug. |
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2013年03月19日 23:54:50 | vstinner | set | recipients:
+ vstinner, Julian |
| 2013年03月19日 23:54:50 | vstinner | set | messageid: <1363737290.89.0.0912247789208.issue16293@psf.upfronthosting.co.za> |
| 2013年03月19日 23:54:50 | vstinner | link | issue16293 messages |
| 2013年03月19日 23:54:50 | vstinner | create |
|