Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upProgress: issue with bytes/str handling (py3) #564
Comments
here's a stack trace where it happens, with gitpython-2.1.1 (I updated since last report):
I think I'm narrowing the issue to the fact that input is supposed to be bytes (former But because the I switched all In either cases, with that solution it's yelling:
but I believe it's unrelated to the issue at hand. So we've got two solutions, etiher make the progress handler bytes and str agnostic (as I first suggested), or change the remote.fetch calls to |
@Byron any preference or idea on it so I can cook a PR? |
@guyzmo Thanks for the elaborate description of the problem and the effort you put in already! As for a PR, I believe to remember that |
uuuurgh… I tried to reproduce the issue today, by removing my patch… and now it's working fine… What. The. Bloody. Hell. O_O I guess I'm closing the issue for now, and next time it happens I'll try to make a minimal replicable snippet of it. I mean it happened twice, it's likely to hit me a third time, because as we say in french: jamais deux sans trois. |
damn… it just hit me again. Same circumstances, same situation. self._cur_line = line = line.decode('utf-8') if isinstance(line, bytes) else line fixed it. Though right now I'm focused on doing a new release of |
The root of the problem is because I'm mocking up the git calling subprocess calls: |
@guyzmo Would you like to contribute the fix? |
I'd be happy to, are you happy with the fix I'm suggesting above? |
It looks good to me, all things considered :). I mean it's probably a lost cause to try to get bytes/string handling right in this project, so applying fixes where needed seems to be a suitable way to make life for users a little bit better. |
|
I wonder if this issue might have been solved by now? |
As suggested in this comment #564 (comment)
@yarikoptic I hope with the linked commit, this issue will be resolved. It's a certainly a quick stab at it. |
Closed due to inactivity - please feel free to comment if there is an interest to pick it up. |
I still am unable to produce a proper minimal reproduceable example — I've been busy with feature implementation to dig this further, but depending on some context to be determined, in the method
_parse_progress_line()
ofRemoteProgress
sometimes the line argument is abytes
string, other times it's anstr
string.I've hit the issue with my implementation in guyzmo/git-repo and to fix it I've made the following fix at line 387 of git.util:
This issue has been noticed with GitPython 2.1.0, I'm upgrading it locally, to see if it hasn't been fixed with 2.1.1, so please pardon me if it's been fixed☺