-
-
Notifications
You must be signed in to change notification settings - Fork 937
If gevent is used, it causes any error to be a gevent.FileObjectClosed(IOError) #1336
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
This could be argued as a bug in gevent, since they are changing the expected behavior. |
Thanks for reporting, and I agree with the assessment. I'd be very interested in hearing which action GitPython is supposed to take. Options I see would be…
Option 1 seems like a possible avenue. I could imagine something like this. try:
import gevent.SpecialFSException
IOException = SpecialFSException
except ImportError:
IOException = ValueError Then this conditional exception type could be used def read_all_from_possibly_closed_stream(stream: Union[IO[bytes], None]) -> bytes:
if stream:
try:
return stderr_b + force_bytes(stream.read())
except IOException:
return stderr_b or b''
else:
return stderr_b or b'' This would only work if |
The documentation for the basic io implementations has indications that callers should expect, at the very least, Given that gevent's |
Just catching |
gevent.monkey.patch_all()
patches stderr to begevent._fileobjectcommon._ClosedIO
object, which raises its ownFileObjectClosed(IOError)
.GitPython only catches ValueError in read_all_from_possibly_closed_stream
The text was updated successfully, but these errors were encountered: