From 3779655435c62ddc9c8587e257ee5b7663647877 Mon Sep 17 00:00:00 2001 From: Zackery Spytz Date: Sun, 20 May 2018 11:37:36 -0600 Subject: [PATCH 1/2] bpo-23860: Remove unneeded lseek() call in mmap.mmap() (on Windows) This was (apparently) necessary on Windows 9x systems, but these operating systems are no longer supported. --- Lib/test/test_mmap.py | 1 + Modules/mmapmodule.c | 3 --- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/Lib/test/test_mmap.py b/Lib/test/test_mmap.py index 55c6ad04d44d828..053a4ca4db53a57 100644 --- a/Lib/test/test_mmap.py +++ b/Lib/test/test_mmap.py @@ -59,6 +59,7 @@ def test_basic(self): f.flush() m = mmap.mmap(f.fileno(), 2 * PAGESIZE) self.addCleanup(m.close) + self.assertEqual(f.tell(), 2 * PAGESIZE) finally: f.close() diff --git a/Modules/mmapmodule.c b/Modules/mmapmodule.c index e521e95d4ded73f..58f1e3b2ddcca70 100644 --- a/Modules/mmapmodule.c +++ b/Modules/mmapmodule.c @@ -2084,9 +2084,6 @@ new_mmap_object(PyTypeObject *type, PyObject *args, PyObject *kwdict) fh = _Py_get_osfhandle(fileno); if (fh == INVALID_HANDLE_VALUE) return NULL; - - /* Win9x appears to need us seeked to zero */ - lseek(fileno, 0, SEEK_SET); } m_obj = (mmap_object *)type->tp_alloc(type, 0); From 07a1122ff8ae2bf5fb02298e64ee676fd2c9ede7 Mon Sep 17 00:00:00 2001 From: Serhiy Storchaka Date: Sun, 9 Aug 2026 20:20:22 +0300 Subject: [PATCH 2/2] Add a NEWS entry --- .../next/Windows/2026-08-09-17-30-00.gh-issue-68048.Mq8Vd4.rst | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 Misc/NEWS.d/next/Windows/2026-08-09-17-30-00.gh-issue-68048.Mq8Vd4.rst diff --git a/Misc/NEWS.d/next/Windows/2026-08-09-17-30-00.gh-issue-68048.Mq8Vd4.rst b/Misc/NEWS.d/next/Windows/2026-08-09-17-30-00.gh-issue-68048.Mq8Vd4.rst new file mode 100644 index 000000000000000..12b5067ba934ec2 --- /dev/null +++ b/Misc/NEWS.d/next/Windows/2026-08-09-17-30-00.gh-issue-68048.Mq8Vd4.rst @@ -0,0 +1,2 @@ +Creating a :class:`mmap.mmap` object on Windows no longer resets the position +of the underlying file to zero, as on other platforms.