Browse Source

Cherry-pick upstream commit FILE5_18-11-ge14d88d "Fix [Python] regression"

Christoph Biedl 10 years ago
parent
commit
0c6e3af2d8

+ 21 - 0
debian/patches/cherry-pick.FILE5_18-11-ge14d88d.fix-python-regression.patch

@@ -0,0 +1,21 @@
+Upstream-Author: Christos Zoulas <christos@zoulas.com>
+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'))

+ 1 - 0
debian/patches/series

@@ -15,3 +15,4 @@ cherry-pick.FILE5_18-2-g1ecdd15.fix-targa-detection.patch
 cherry-pick.FILE5_18-7-g2c947ac.raise-the-strength-of-the-targa.patch
 cherry-pick.FILE5_18-4-g966ca13.improve-palm-library-detection.patch
 cherry-pick.FILE5_18-6-g0b62876.remove-extra-line.patch
+cherry-pick.FILE5_18-11-ge14d88d.fix-python-regression.patch