diff options
author | Sebastian Thiel <sthiel@thoughtworks.com> | 2019-07-20 17:26:16 +0800 |
---|---|---|
committer | Sebastian Thiel <sthiel@thoughtworks.com> | 2019-07-20 17:34:19 +0800 |
commit | dac619e4917b0ad43d836a534633d68a871aecca (patch) | |
tree | 7b6608753801c576014a6b5de396230a4ec2bb5b /git/compat.py | |
parent | 1bb0b1751b38da43dbcd2ec58e71eb7b0138d786 (diff) | |
download | gitpython-dac619e4917b0ad43d836a534633d68a871aecca.tar.gz |
Drop python 2.7 support and help with encodings
Fixes #312
Diffstat (limited to 'git/compat.py')
-rw-r--r-- | git/compat.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/git/compat.py b/git/compat.py index b63768f3..02dc69de 100644 --- a/git/compat.py +++ b/git/compat.py @@ -30,7 +30,10 @@ PY3 = sys.version_info[0] >= 3 is_win = (os.name == 'nt') is_posix = (os.name == 'posix') is_darwin = (os.name == 'darwin') -defenc = sys.getdefaultencoding() +if hasattr(sys, 'getfilesystemencoding'): + defenc = sys.getfilesystemencoding() +if defenc is None: + defenc = sys.getdefaultencoding() if PY3: import io |