Failing test case for hasattr() problem

Before Python3, hasattr(x, 'attr') would swallow exceptions, even
sh.ErrorReturnCode.  hasattr(sh.something, 'attr') can have side
effects, but this change tries to work around this to the extent it can,
by only causing side effects if the string object would actually have
the desired attribute.

I ran into this behavior in code that was trying to decide whether
something was a file, so it did hasattr(something, 'read').  Pretty
reasonable, but it caused the entire output of the command to be read
into memory, and any exceptions to be swallowed.
Proposed workaround for Py2 hasattr() problem
Merge branch 'hasattr-fix' of git://github.com/tgs/sh into hasattr-fixQ

Conflicts:
	sh.py
more comments
Merge branch 'hasattr-fixQ' into release-1.10