Add support for StringIO objects to readline

For testing purposed I would like to be able to mock stdio/stdout with StringIO objects. This is not currently possible with readline due to an explicit check for a FILE type.