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
Bugs in curses.ascii predicates #71266
Comments
Most curses.ascii predicates corresponds C functions declared in <ctype.h>. But there are some differences:
These differences look as bugs. Proposed patch fixes them and adds tests for all curses.ascii functions. |
Committed with wrong commit message (damn two clipboards on X11) in ac8338546ca8, d7b6c07bc713, d03c8d0a6a73. |
There is an overlapping issue from 2010: "curses.ascii.isblank() function is broken. It confuses backspace (BS 0x08) with tab (0x09)" http://bugs.python.org/issue9770 Your patch fixes it too (it should be closed). Note: the patch does not pass tests from Lib/test/test_curses_ascii.py attached to bpo-9770 (even if the code: $ ./python
>>> import curses.ascii
>>> curses.ascii.iscntrl(-1) #XXX expected False
True If we ignore negative ints then isblank, ispunct, iscntrl provided in the curses_ascii.patch are ok. |
Since screen.getch() can return -1, it looks reasonable to make curses.ascii predicates to work with negative integers. Do you want to open a new issue and write a patch Akira? |
I'm not sure anything should be done (e.g., it is "undefined behavior" to pass a negative value such as CHAR_MIN (if *char* type is signed) to a character classification function in C. Though EOF value (-1 traditionally) should be handled). If you want to explore it further; I've enumerated open questions in 2014 (inconsistent TypeError, ord(c) > 0x100, negative ints handling, etc) http://bugs.python.org/issue9770#msg221008 |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: