Commits

Andrew Robinson  committed 1b0c70e

Satisfying Pillow's Python 3 deprecation warnings

  • Participants
  • Parent commits 953a2d8

Comments (0)

Files changed (2)

File src/reportlab/__init__.py

 
 import sys
 
-if sys.version_info[0:2] < (2, 5):
-    warning = """The trunk of reportlab currently requires Python 2.5 or higher.
+if sys.version_info[0:2] < (2, 7):
+    warning = """The trunk of reportlab currently requires Python 2.7 or higher.
+
+    This is being done to let us move forwards with 2.7/3.x compatibility
+    with the minimum of baggage.
+    
+    ReportLab 2.7 was the last packaged version to suppo0rt Python 2.5 and 2.6.
 
     Python 2.3 users may still use ReportLab 2.4 or any other bugfixes
     derived from it, and Python 2.4 users may use ReportLab 2.5.  

File src/reportlab/lib/utils.py

                     elif mode not in ('L','RGB','CMYK'):
                         im = im.convert('RGB')
                         self.mode = 'RGB'
-                    self._data = im.tostring()
+                    if hasattr(im, 'tobytes'):  #make pillow and PIL both happy, for now
+                        self._data = im.tobytes()
+                    else:
+                        self._data = im.tostring()
             return self._data
         except:
             annotateException('\nidentity=%s'%self.identity())