[SciPy-dev] possible pilutils.py bug + patch

Hayden John Callow h.callow at elec.canterbury.ac.nz
Sat Oct 26 03:00:29 EDT 2002


with slightly old scipy cvs 
scipy.imshow() segfaults with complex arrays

(I presume that complex arrays are not a desired input)

I have included a patch to trap complex array arguments


System info --> RH8.0 + python 2.2.1

>>> scipy.__cvs_version__.cvs_version
(1, 144, 1520, 4373)

>>> Image.VERSION
'1.1.2'

>>> sys.version
'2.2.1 (#1, Aug 30 2002, 12:15:30) \n[GCC 3.2 20020822 (Red Hat Linux
Rawhide 3.2-4)]'

cheers

Hayden






 


-------------- next part --------------
--- pilutil.py	2002-10-26 19:38:27.000000000 +1300
+++ pilutil_new.py	2002-10-26 19:40:24.000000000 +1300
@@ -100,6 +100,10 @@
     The Numeric array must be either 2 dimensional or 3 dimensional.
     """
     data = Numeric.asarray(arr)
+
+    real_img = data.typecode() not in Numeric.typecodes['Complex']
+    assert real_img, "Not a suitable array: can't use complex images"
+
     shape = list(data.shape)
     valid = len(shape)==2 or ((len(shape)==3) and \
                               ((3 in shape) or (4 in shape)))


More information about the SciPy-Dev mailing list