From 6aa78cd3b969ede76a1a6e660962e898421d4ed8 Mon Sep 17 00:00:00 2001 From: Harmon Date: Fri, 7 Feb 2020 05:56:27 -0600 Subject: Remove checks for Python 2 and/or 3 --- git/diff.py | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) (limited to 'git/diff.py') diff --git a/git/diff.py b/git/diff.py index 42a68dfc..567e3e70 100644 --- a/git/diff.py +++ b/git/diff.py @@ -6,10 +6,7 @@ import re from git.cmd import handle_process_output -from git.compat import ( - defenc, - PY3 -) +from git.compat import defenc from git.util import finalize_process, hex_to_bin from .objects.blob import Blob @@ -27,10 +24,7 @@ _octal_byte_re = re.compile(b'\\\\([0-9]{3})') def _octal_repl(matchobj): value = matchobj.group(1) value = int(value, 8) - if PY3: - value = bytes(bytearray((value,))) - else: - value = chr(value) + value = bytes(bytearray((value,))) return value @@ -369,8 +363,6 @@ class Diff(object): # Python2 silliness: have to assure we convert our likely to be unicode object to a string with the # right encoding. Otherwise it tries to convert it using ascii, which may fail ungracefully res = h + msg - if not PY3: - res = res.encode(defenc) # end return res -- cgit v1.2.1