From f38cc9011f61751f0aa4f6defa79864c58932fc2 Mon Sep 17 00:00:00 2001 From: technillogue Date: Tue, 7 Nov 2023 21:08:19 -0500 Subject: [PATCH 1/2] pythongh-111835: Add seekable method to mmap.mmap --- Modules/mmapmodule.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Modules/mmapmodule.c b/Modules/mmapmodule.c index d11200a4042551..f6300e6890af12 100644 --- a/Modules/mmapmodule.c +++ b/Modules/mmapmodule.c @@ -737,6 +737,14 @@ mmap_seek_method(mmap_object *self, PyObject *args) return NULL; } + +static PyObject * +mmap_seekable_method(mmap_object *self, PyObject *unused) +{ + Py_RETURN_TRUE; +} + + static PyObject * mmap_move_method(mmap_object *self, PyObject *args) { @@ -905,6 +913,7 @@ static struct PyMethodDef mmap_object_methods[] = { {"readline", (PyCFunction) mmap_read_line_method, METH_NOARGS}, {"resize", (PyCFunction) mmap_resize_method, METH_VARARGS}, {"seek", (PyCFunction) mmap_seek_method, METH_VARARGS}, + {"seekable", (PyCFunction) mmap_seekable_method, METH_NOARGS}, {"size", (PyCFunction) mmap_size_method, METH_NOARGS}, {"tell", (PyCFunction) mmap_tell_method, METH_NOARGS}, {"write", (PyCFunction) mmap_write_method, METH_VARARGS}, From 97271000aafe00b6d804756804dde42cfa19766b Mon Sep 17 00:00:00 2001 From: "blurb-it[bot]" <43283697+blurb-it[bot]@users.noreply.github.com> Date: Wed, 8 Nov 2023 18:47:34 +0000 Subject: [PATCH 2/2] =?UTF-8?q?=F0=9F=93=9C=F0=9F=A4=96=20Added=20by=20blu?= =?UTF-8?q?rb=5Fit.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../next/Library/2023-11-08-18-47-33.gh-issue-111835.1LuxPJ.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 Misc/NEWS.d/next/Library/2023-11-08-18-47-33.gh-issue-111835.1LuxPJ.rst diff --git a/Misc/NEWS.d/next/Library/2023-11-08-18-47-33.gh-issue-111835.1LuxPJ.rst b/Misc/NEWS.d/next/Library/2023-11-08-18-47-33.gh-issue-111835.1LuxPJ.rst new file mode 100644 index 00000000000000..68a1cd19e3acfa --- /dev/null +++ b/Misc/NEWS.d/next/Library/2023-11-08-18-47-33.gh-issue-111835.1LuxPJ.rst @@ -0,0 +1 @@ +The :class:`mmap.mmap` class now has an :meth:`~mmap.mmap.seekable` method that can be used where a file-like object with a seekable method is required. (Contributed by Sylvie Liberman in :gh:`111865`.)