summaryrefslogtreecommitdiff
path: root/git/compat.py
diff options
context:
space:
mode:
authorHarmon <Harmon758@gmail.com>2020-02-07 05:30:04 -0600
committerSebastian Thiel <sebastian.thiel@icloud.com>2020-02-08 10:55:50 +0800
commitc5f3c586e0f06df7ee0fc81289c93d393ea21776 (patch)
tree7018062e2d8438555d4c018b9d53ca7d2837bed2 /git/compat.py
parentc7392d68121befe838d2494177531083e22b3d29 (diff)
downloadgitpython-c5f3c586e0f06df7ee0fc81289c93d393ea21776.tar.gz
Remove and replace compat._unichr
Diffstat (limited to 'git/compat.py')
-rw-r--r--git/compat.py10
1 files changed, 4 insertions, 6 deletions
diff --git a/git/compat.py b/git/compat.py
index da500750..b048e16e 100644
--- a/git/compat.py
+++ b/git/compat.py
@@ -118,10 +118,8 @@ def b(data):
return data
if PY3:
- _unichr = chr
bytes_chr = lambda code: bytes((code,))
else:
- _unichr = unichr
bytes_chr = chr
def surrogateescape_handler(exc):
@@ -176,9 +174,9 @@ def replace_surrogate_encode(mystring, exc):
# 0x80 | (code & 0x3f)]
# Is this a good idea?
if 0xDC00 <= code <= 0xDC7F:
- decoded.append(_unichr(code - 0xDC00))
+ decoded.append(chr(code - 0xDC00))
elif code <= 0xDCFF:
- decoded.append(_unichr(code - 0xDC00))
+ decoded.append(chr(code - 0xDC00))
else:
raise NotASurrogateError
return str().join(decoded)
@@ -197,9 +195,9 @@ def replace_surrogate_decode(mybytes):
else:
code = ord(ch)
if 0x80 <= code <= 0xFF:
- decoded.append(_unichr(0xDC00 + code))
+ decoded.append(chr(0xDC00 + code))
elif code <= 0x7F:
- decoded.append(_unichr(code))
+ decoded.append(chr(code))
else:
# # It may be a bad byte
# # Try swallowing it.