Skip to content

Raising of GitCommandError fails in archive function if stdout was a cStringIO object #619

Closed
@wohauser

Description

@wohauser

I tried to check out an archive for a not existing path from the repository and I expect a GitCommandError exception.

I got following TypeError exception:
"Expected bytes or text, but got <cStringIO.StringO object at 0x7fabac6f97a0>"

I did following:
fpt = StringIO()
-- (used as a temporary storage for the tar archive)
self._repository.archive(fpt, treeish=version_identifier, format="tar", path=sub_path)
-- (where sub_path points to an not existing path)

The cause of the problem was, the Constructor of the GitCommandError could not handle the cStringIO object. (a normal file pointer may be faulty too).
I suppose it should set its stdout variable to None in case of not handled types. Or it should be adjusted when raising the exception.

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