I suspect that, in the case of timeout, the old function is never
restored, and remains NULL. (I'm puzzled that this isn't repeatable,
unless readline is completely disabled.)
I hope this makes sense to somebody, because the signal handling code
and add_unwind_protect looks... scary, and out of my depth to patch.