I've been heading down a twisted path that's led me to run the curses regression test on a build that's been forced to use the curses has_key emulation code.
It fails on the "has_key(13)" line in the test, and the has_key.py code looks questionable to me: it does:
capability_name = _capability_names[ch]
if _curses.tigetstr(capability_name): return 1 else: return 0
The keys in the _capability_names dictionary are taken from the curses keycodes and are in the range octal 0400 to 0777, so the dictionary lookup on a key of 13 takes a KeyError exception - which is not caught, as can be seen above.
Any thoughts?