diff options
| author | Bruno ReniƩ <brutasse@gmail.com> | 2014-03-04 19:34:10 +0100 |
|---|---|---|
| committer | Bruno ReniƩ <brutasse@gmail.com> | 2014-03-04 19:36:41 +0100 |
| commit | 1c8424ec7c1f4f368cf8e19e33fcfdae3de925d4 (patch) | |
| tree | 907cd5e64ea86e34880080165424e88c7f64a1f3 /magic.py | |
| parent | 8c923032c76f7e17fd45b5f90f14ffb899ae5dcd (diff) | |
| download | python-magic-1c8424ec7c1f4f368cf8e19e33fcfdae3de925d4.tar.gz | |
Workaround sys.version_info not being a named tuple on py26
Diffstat (limited to 'magic.py')
| -rw-r--r-- | magic.py | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -195,9 +195,9 @@ def coerce_filename(filename): # ctypes will implicitly convert unicode strings to bytes with # .encode('ascii'). A more useful default here is # getfilesystemencoding(). We need to leave byte-str unchanged. - is_unicode = (sys.version_info.major <= 2 and + is_unicode = (sys.version_info[0] <= 2 and isinstance(filename, unicode)) or \ - (sys.version_info.major >= 3 and + (sys.version_info[0] >= 3 and isinstance(filename, str)) if is_unicode: return filename.encode(sys.getfilesystemencoding()) |
