The fix for issue #863 was incomplete as both OSError or ValueError could be
raised by os.fstat(). Thus we need to catch both types of exceptions
Additionally fixed some PEP8 formatting issues.
bike-shedding spotted, but can you split it in 2 commit? One for the PEP8 fix and the other for the exception clause?
otherwise the patch is OK for me.
Catch OSError as well as ValueError on race condition
Thanks for merging this in so promptly.