diff options
Diffstat (limited to 'fastimport/helpers.py')
-rw-r--r-- | fastimport/helpers.py | 17 |
1 files changed, 4 insertions, 13 deletions
diff --git a/fastimport/helpers.py b/fastimport/helpers.py index e252d09..78fe50c 100644 --- a/fastimport/helpers.py +++ b/fastimport/helpers.py @@ -104,24 +104,15 @@ def is_inside_any(dir_list, fname): def utf8_bytes_string(s): """Convert a string to a bytes string (if necessary, encode in utf8)""" - if sys.version_info[0] == 2: - if isinstance(s, str): - return s - else: - return s.encode('utf8') + if isinstance(s, str): + return bytes(s, encoding='utf8') else: - if isinstance(s, str): - return bytes(s, encoding='utf8') - else: - return s + return s def repr_bytes(obj): """Return a bytes representation of the object""" - if sys.version_info[0] == 2: - return repr(obj) - else: - return bytes(obj) + return bytes(obj) class newobject(object): |