Repository: python-pillow/Pillow

Issue:
Ubuntu 10.04 LTS Compatibility
2 Errors, both in the Gaussian blur filter.

10.04, Stock python 2.6.5, x86

```
Tests/test_image_filter.py:28: filter(ImageFilter.Kernel((3, 3), list(range(9)))) failed:
Traceback (most recent call last):
  File "Tests/test_image_filter.py", line 28, in test_sanity
    filter(ImageFilter.Kernel((3, 3), list(range(9))))
  File "Tests/test_image_filter.py", line 10, in filter
    out = im.filter(filter)
  File "/usr/local/lib/python2.6/dist-packages/Pillow-2.0.0-py2.6-linux-i686.egg/PIL/Image.py", line 828, in filter
    if isinstance(filter, collections.Callable):
  File "/usr/lib/python2.6/abc.py", line 134, in __instancecheck__
    return (cls.__subclasscheck__(subclass) or
  File "/usr/lib/python2.6/abc.py", line 150, in __subclasscheck__
    ok = cls.__subclasshook__(subclass)
  File "/usr/lib/python2.6/_abcoll.py", line 117, in __subclasshook__
    if any("__call__" in B.__dict__ for B in C.__mro__):
AttributeError: class Kernel has no attribute '__mro__'
```

...

```
Traceback (most recent call last):
  File "Tests/test_imageops_usm.py", line 24, in test_filter_api
    i = im.filter(filter)
  File "/usr/local/lib/python2.6/dist-packages/Pillow-2.0.0-py2.6-linux-i686.egg/PIL/Image.py", line 828, in filter
    if isinstance(filter, collections.Callable):
  File "/usr/lib/python2.6/abc.py", line 134, in __instancecheck__
    return (cls.__subclasscheck__(subclass) or
  File "/usr/lib/python2.6/abc.py", line 150, in __subclasscheck__
    ok = cls.__subclasshook__(subclass)
  File "/usr/lib/python2.6/_abcoll.py", line 117, in __subclasshook__
    if any("__call__" in B.__dict__ for B in C.__mro__):
AttributeError: class GaussianBlur has no attribute '__mro__'
```



Discussion:
There's a single failure for the shipped python3 (3.1) in 10.04 LTS

I wouldn't consider this a priority, since 3.1 isn't supported anywhere else, and no one sane would be trying to use 3.1 on an old LTS. (but hey, I've got the vm so I thought I'd give it a whirl)

```
running test_image_getim ...
Tests/test_image_getim.py:11: assert_true("PyCapsule" in type_repr) failed:
- got False, expected true value
```

10.04 x64, Stock python 2.6.5

Same errors as 32 bit, but one additional:

```
Tests/test_imagecms.py:68: p = ImageCms.getOpenProfile(BytesIO(i.info["icc_profile"])) failed:
Traceback (most recent call last):
  File "Tests/test_imagecms.py", line 68, in test_sanity
    p = ImageCms.getOpenProfile(BytesIO(i.info["icc_profile"]))
  File "/usr/local/lib/python2.6/dist-packages/Pillow-2.0.0-py2.6-linux-x86_64.egg/PIL/ImageCms.py", line 338, in getOpenProfile
    return ImageCmsProfile(profileFilename)
  File "/usr/local/lib/python2.6/dist-packages/Pillow-2.0.0-py2.6-linux-x86_64.egg/PIL/ImageCms.py", line 145, in __init__
    self._set(core.profile_frombytes(profile.read()))
AttributeError: 'module' object has no attribute 'profile_frombytes'
```

We're definitely not supporting 3.1


Resolving patch:
diff --git a/PIL/ImageFilter.py b/PIL/ImageFilter.py
--- a/PIL/ImageFilter.py
+++ b/PIL/ImageFilter.py
@@ -17,7 +17,7 @@
 
 from functools import reduce
 
-class Filter:
+class Filter(object):
     pass
 
 ##


Test patch:
diff --git a/Tests/test_file_webp.py b/Tests/test_file_webp.py
--- a/Tests/test_file_webp.py
+++ b/Tests/test_file_webp.py
@@ -2,7 +2,12 @@
 
 from PIL import Image
 
-def xtest_read():
+try:
+    import _webp
+except:
+    skip('webp support not installed')
+		
+def test_read():
     """ Can we write a webp without error. Does it have the bits we expect?"""
     
     file = "Images/lena.webp"