Implement excepthook as a method rather than an attribute.

This allows overriding excepthook in a subclass of Loop, in addition to
the current method of assigning to the excepthook instance attribute.

Added tests for the behavior of excepthook in the various cases.