From 4f9b2dbe69a8bcd37f1e8759864883acb4449bce Mon Sep 17 00:00:00 2001 From: wiredfool Date: Mon, 13 Oct 2014 11:12:14 -0700 Subject: [PATCH] Fix pypy 2.4 regression, #952 --- PIL/TiffImagePlugin.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/PIL/TiffImagePlugin.py b/PIL/TiffImagePlugin.py index 50648288e..4e76379c0 100644 --- a/PIL/TiffImagePlugin.py +++ b/PIL/TiffImagePlugin.py @@ -883,6 +883,10 @@ class TiffImageFile(ImageFile.ImageFile): try: fp = hasattr(self.fp, "fileno") and \ os.dup(self.fp.fileno()) + # flush the file descriptor, prevents error on pypy 2.4+ + # should also eliminate the need for fp.tell for py3 + # in _seek + self.fp.flush() except IOError: # io.BytesIO have a fileno, but returns an IOError if # it doesn't use a file descriptor.