From d78371cccd94cb8d0c0462e3a176644865a5f1a1 Mon Sep 17 00:00:00 2001 From: David Schmidt Date: Thu, 23 May 2013 19:45:39 +0300 Subject: [PATCH 1/2] remove a float/int problem --- PIL/GifImagePlugin.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PIL/GifImagePlugin.py b/PIL/GifImagePlugin.py index 1254a396f..0a6bd9c44 100644 --- a/PIL/GifImagePlugin.py +++ b/PIL/GifImagePlugin.py @@ -386,7 +386,7 @@ def getheader(im, palette=None, info=None): # calculate the palette size for the header import math - colorTableSize = math.ceil(math.log(len(paletteBytes)//3, 2))-1 + colorTableSize = int(math.ceil(math.log(len(paletteBytes)//3, 2)))-1 if colorTableSize < 0: colorTableSize = 0 s.append(o8(colorTableSize + 128)) # size of global color table + global color table flag s.append(o8(0) + o8(0)) # background + reserved/aspect From 65266a74193edc59fcae91d513efd771bc8413a8 Mon Sep 17 00:00:00 2001 From: David Schmidt Date: Thu, 23 May 2013 20:02:19 +0300 Subject: [PATCH 2/2] Update test_file_gif.py remove warning --- Tests/test_file_gif.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Tests/test_file_gif.py b/Tests/test_file_gif.py index 3d3d43a7e..0c27865cd 100644 --- a/Tests/test_file_gif.py +++ b/Tests/test_file_gif.py @@ -9,7 +9,8 @@ if "gif_encoder" not in codecs or "gif_decoder" not in codecs: # sample gif stream file = "Images/lena.gif" -data = open(file, "rb").read() +with open(file, "rb") as f: + data = f.read() def test_sanity(): im = Image.open(file)