Skip to content

If gevent is used, it causes any error to be a gevent.FileObjectClosed(IOError) #1336

Closed
@aethanol

Description

@aethanol

gevent.monkey.patch_all() patches stderr to be gevent._fileobjectcommon._ClosedIO object, which raises its own FileObjectClosed(IOError).

class _ClosedIO(object):
    ...
    def __getattr__(self, name):
        if name == 'name':
            # We didn't set it in __init__ because there wasn't one
            raise AttributeError
        raise FileObjectClosed

GitPython only catches ValueError in read_all_from_possibly_closed_stream

def read_all_from_possibly_closed_stream(stream: Union[IO[bytes], None]) -> bytes:
    if stream:
        try:
            return stderr_b + force_bytes(stream.read())
        except ValueError:
            return stderr_b or b''
    else:
        return stderr_b or b''

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions