-
-
Notifications
You must be signed in to change notification settings - Fork 933
Crash with unicode filename and Python3 #532
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
Thanks @petertodd. |
Oh sorry, all those details are in the commit message for the test repo: petertodd/gitpython-unicode-error@e8a5d25 |
Thanks a lot for the easy way reproduce the issue ! Traceback (most recent call last):
File "./test.py", line 9, in <module>
tuple(tree)
File "/Users/byron/dev/py/GitPython/git/objects/tree.py", line 207, in _iter_convert_to_object
path = join_path(self.path, name)
File "/Users/byron/dev/py/GitPython/git/util.py", line 125, in join_path
if b.startswith('/'):
TypeError: startswith first arg must be bytes or a tuple of bytes, not str |
I have had a look, and just want to leave my findings here in case someone else wants to fix it for good. The current tree implementation tries to decode bytes as unicode, but simply returns bytes if that fails. Thus the type returned is What I tried to do is to remove the conditional behaviour in |
The situation is further complicated by the transition from Py2-->PY3, I know. [edit] Note that in Windows there are 2 kinds of errors still remaining: resource leaks and unicode, |
@ankostis Thanks for the tip! That seems to be exactly what I was looking for ! Now I am curious whether the barrage of CI nodes still like the project, my local testing was certainly spotty. |
Wow, amazingly fast (finding also a backported PEP 383). |
Fast, but not good :)! I broke the build - am on it now, let's hope I can do it in the remaining 30m I have for today. |
Awesome! Thanks for the quick response; looking forward to the next release. |
FWIW, this is the software I'm using GitPython for: https://petertodd.org/2016/opentimestamps-announcement specifically Git commit timestamping: |
Here's a repo that reproduces the error: https://github.com/petertodd/gitpython-unicode-error
The filename in question is 'v\udcbb', and print('v\udcbb') raises "UnicodeEncodeError: 'utf-8' codec can't encode character '\udcbb' in position 1: surrogates not allowed", so likely there's some kind of unicode-related problem here.
The text was updated successfully, but these errors were encountered: