mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-08-14 09:14:45 +03:00
Add in cherry-pick
This commit is contained in:
parent
39a535fb0f
commit
411ff3322c
Binary file not shown.
|
@ -1,6 +1,7 @@
|
||||||
import io
|
import io
|
||||||
|
|
||||||
from PIL import EpsImagePlugin, Image
|
from PIL import EpsImagePlugin, Image
|
||||||
|
import pytest
|
||||||
|
|
||||||
from .helper import PillowTestCase, hopper, unittest
|
from .helper import PillowTestCase, hopper, unittest
|
||||||
|
|
||||||
|
@ -252,3 +253,17 @@ class TestFileEps(PillowTestCase):
|
||||||
self.assertEqual(image.mode, "RGB")
|
self.assertEqual(image.mode, "RGB")
|
||||||
self.assertEqual(image.size, (460, 352))
|
self.assertEqual(image.size, (460, 352))
|
||||||
self.assertEqual(image.format, "EPS")
|
self.assertEqual(image.format, "EPS")
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.timeout(timeout=5)
|
||||||
|
@pytest.mark.parametrize(
|
||||||
|
"test_file",
|
||||||
|
[
|
||||||
|
("Tests/images/timeout-d675703545fee17acab56e5fec644c19979175de.eps")
|
||||||
|
],
|
||||||
|
)
|
||||||
|
def test_timeout(test_file):
|
||||||
|
with open(test_file, "rb") as f:
|
||||||
|
with pytest.raises(Image.UnidentifiedImageError):
|
||||||
|
with Image.open(f):
|
||||||
|
pass
|
||||||
|
|
|
@ -183,12 +183,12 @@ class PSFile(object):
|
||||||
self.fp.seek(offset, whence)
|
self.fp.seek(offset, whence)
|
||||||
|
|
||||||
def readline(self):
|
def readline(self):
|
||||||
s = self.char or b""
|
s = [self.char or b""]
|
||||||
self.char = None
|
self.char = None
|
||||||
|
|
||||||
c = self.fp.read(1)
|
c = self.fp.read(1)
|
||||||
while c not in b"\r\n":
|
while (c not in b"\r\n") and len(c):
|
||||||
s = s + c
|
s.append(c)
|
||||||
c = self.fp.read(1)
|
c = self.fp.read(1)
|
||||||
|
|
||||||
self.char = self.fp.read(1)
|
self.char = self.fp.read(1)
|
||||||
|
@ -196,7 +196,7 @@ class PSFile(object):
|
||||||
if self.char in b"\r\n":
|
if self.char in b"\r\n":
|
||||||
self.char = None
|
self.char = None
|
||||||
|
|
||||||
return s.decode("latin-1")
|
return b"".join(s).decode("latin-1")
|
||||||
|
|
||||||
|
|
||||||
def _accept(prefix):
|
def _accept(prefix):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user