mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-11-10 19:56:47 +03:00
Fixed opening mmap image through Path on Windows
This commit is contained in:
parent
c15dc4d7ca
commit
691df96734
|
@ -76,6 +76,10 @@ class TestImage(PillowTestCase):
|
|||
@unittest.skipUnless(Image.HAS_PATHLIB, "requires pathlib/pathlib2")
|
||||
def test_pathlib(self):
|
||||
from PIL.Image import Path
|
||||
im = Image.open(Path("Tests/images/multipage-mmap.tiff"))
|
||||
self.assertEqual(im.mode, "P")
|
||||
self.assertEqual(im.size, (10, 10))
|
||||
|
||||
im = Image.open(Path("Tests/images/hopper.jpg"))
|
||||
self.assertEqual(im.mode, "RGB")
|
||||
self.assertEqual(im.size, (128, 128))
|
||||
|
|
|
@ -2643,10 +2643,10 @@ def open(fp, mode="r"):
|
|||
|
||||
exclusive_fp = False
|
||||
filename = ""
|
||||
if isPath(fp):
|
||||
filename = fp
|
||||
elif HAS_PATHLIB and isinstance(fp, Path):
|
||||
if HAS_PATHLIB and isinstance(fp, Path):
|
||||
filename = str(fp.resolve())
|
||||
elif isPath(fp):
|
||||
filename = fp
|
||||
|
||||
if filename:
|
||||
fp = builtins.open(filename, "rb")
|
||||
|
|
Loading…
Reference in New Issue
Block a user