diff --git a/PIL/ImageFile.py b/PIL/ImageFile.py index 94f705b3c..52c2ed34c 100644 --- a/PIL/ImageFile.py +++ b/PIL/ImageFile.py @@ -211,7 +211,7 @@ class ImageFile(Image.Image): else: raise IOError("image file is truncated") - if not s and not decoder.handles_eof: # truncated jpeg + if not s: # truncated jpeg self.tile = [] # JpegDecode needs to clean things up here either way diff --git a/decode.c b/decode.c index f700747e1..91de1075e 100644 --- a/decode.c +++ b/decode.c @@ -52,7 +52,6 @@ typedef struct { struct ImagingCodecStateInstance state; Imaging im; PyObject* lock; - int handles_eof; int pulls_fd; } ImagingDecoderObject; @@ -95,9 +94,6 @@ PyImaging_DecoderNew(int contextsize) /* Initialize the cleanup function pointer */ decoder->cleanup = NULL; - /* Most decoders don't want to handle EOF themselves */ - decoder->handles_eof = 0; - /* set if the decoder needs to pull data from the fd, instead of having it pushed */ decoder->pulls_fd = 0; @@ -239,12 +235,6 @@ _setfd(ImagingDecoderObject* decoder, PyObject* args) } -static PyObject * -_get_handles_eof(ImagingDecoderObject *decoder) -{ - return PyBool_FromLong(decoder->handles_eof); -} - static PyObject * _get_pulls_fd(ImagingDecoderObject *decoder) { @@ -260,9 +250,6 @@ static struct PyMethodDef methods[] = { }; static struct PyGetSetDef getseters[] = { - {"handles_eof", (getter)_get_handles_eof, NULL, - "True if this decoder expects to handle EOF itself.", - NULL}, {"pulls_fd", (getter)_get_pulls_fd, NULL, "True if this decoder expects to pull from self.fd itself.", NULL}, @@ -918,7 +905,6 @@ PyImaging_Jpeg2KDecoderNew(PyObject* self, PyObject* args) if (decoder == NULL) return NULL; - decoder->handles_eof = 1; decoder->pulls_fd = 1; decoder->decode = ImagingJpeg2KDecode; decoder->cleanup = ImagingJpeg2KDecodeCleanup;