From ac12edcfc5b45561c86b7a0a9a8e0638f72527ca Mon Sep 17 00:00:00 2001
From: Andrew Murray <radarhere@users.noreply.github.com>
Date: Wed, 12 Jan 2022 11:35:32 +1100
Subject: [PATCH 4/5] Added patch to fix failing Windows test

---
 src/PIL/TiffImagePlugin.py | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/PIL/TiffImagePlugin.py b/src/PIL/TiffImagePlugin.py
index 431edfd9b..457299261 100644
--- a/src/PIL/TiffImagePlugin.py
+++ b/src/PIL/TiffImagePlugin.py
@@ -1248,6 +1248,10 @@ class TiffImageFile(ImageFile.ImageFile):
         # file descriptor, use that instead of reading
         # into a string in python.
         # libtiff closes the file descriptor, so pass in a dup.
+        position = self.fp.tell()
+        self.fp.seek(0)
+        fp = io.BytesIO(self.fp.read())
+        self.fp.seek(position)
         try:
             fp = hasattr(self.fp, "fileno") and os.dup(self.fp.fileno())
             # flush the file descriptor, prevents error on pypy 2.4+
-- 
2.38.1.windows.1

