This closes patch:

[ 960406 ] unblock signals in threads

although the changes do not correspond exactly to any patch attached to
that report.

Non-main threads no longer have all signals masked.

A different interface to readline is used.

The handling of signals inside calls to PyOS_Readline is now rather
different.

These changes are all a bit scary!  Review and cross-platform testing
much appreciated.
diff --git a/Python/pythonrun.c b/Python/pythonrun.c
index 113ff2d..d89e5e9 100644
--- a/Python/pythonrun.c
+++ b/Python/pythonrun.c
@@ -1435,7 +1435,8 @@
 		msg = "EOL while scanning single-quoted string";
 		break;
 	case E_INTR:
-		PyErr_SetNone(PyExc_KeyboardInterrupt);
+		if (!PyErr_Occurred())
+			PyErr_SetNone(PyExc_KeyboardInterrupt);
 		Py_XDECREF(v);
 		return;
 	case E_NOMEM: