Upstream-Author: Christos Zoulas Date: Thu Apr 3 20:47:24 2014 +0000 Upstream-Commit: e14d88d8df2aafb74ba0c0b3d0116fc84b68cbd8 Description: Fix regression: If a file was already bytes, don't try to convert it. From: Arfrever Frehtes Taifersar Arahesis --- a/python/magic.py +++ b/python/magic.py @@ -116,7 +116,10 @@ is set. A call to errno() will return the numeric error code. """ try: # attempt python3 approach first - bi = bytes(filename, 'utf-8') + if isinstance(filename, bytes): + bi = filename + else: + bi = bytes(filename, 'utf-8') return str(_file(self._magic_t, bi), 'utf-8') except: return _file(self._magic_t, filename.encode('utf-8'))