Skip to content

Commit e50ee0a

Browse files
Harmon758Byron
authored andcommitted
Remove and replace compat.bytes_chr
1 parent c5f3c58 commit e50ee0a

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

‎git/compat.py

+3-8
Original file line numberDiff line numberDiff line change
@@ -117,11 +117,6 @@ def b(data):
117117
return data.encode('latin1')
118118
return data
119119

120-
if PY3:
121-
bytes_chr = lambda code: bytes((code,))
122-
else:
123-
bytes_chr = chr
124-
125120
def surrogateescape_handler(exc):
126121
"""
127122
Pure Python implementation of the PEP 383: the "surrogateescape" error
@@ -216,9 +211,9 @@ def encodefilename(fn):
216211
for index, ch in enumerate(fn):
217212
code = ord(ch)
218213
if code < 128:
219-
ch = bytes_chr(code)
214+
ch = bytes((code,))
220215
elif 0xDC80 <= code <= 0xDCFF:
221-
ch = bytes_chr(code - 0xDC00)
216+
ch = bytes((code - 0xDC00,))
222217
else:
223218
raise UnicodeEncodeError(FS_ENCODING,
224219
fn, index, index+1,
@@ -233,7 +228,7 @@ def encodefilename(fn):
233228
code = ord(ch)
234229
if 0xD800 <= code <= 0xDFFF:
235230
if 0xDC80 <= code <= 0xDCFF:
236-
ch = bytes_chr(code - 0xDC00)
231+
ch = bytes((code - 0xDC00,))
237232
encoded.append(ch)
238233
else:
239234
raise UnicodeEncodeError(

0 commit comments

Comments
 (0)