]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Revert "gh-66234: Add flag to disable the use of mmap in dbm.gnu (GH-135005)" (GH...
authorSerhiy Storchaka <storchaka@gmail.com>
Sat, 20 Sep 2025 08:01:44 +0000 (11:01 +0300)
committerGitHub <noreply@github.com>
Sat, 20 Sep 2025 08:01:44 +0000 (11:01 +0300)
This reverts commit 0cec424af5904b3d23ad6e3c6d1a27f89d238d64.

Doc/library/dbm.rst
Doc/whatsnew/3.15.rst
Lib/test/test_dbm_gnu.py
Misc/NEWS.d/next/Library/2025-06-01-15-13-07.gh-issue-66234.Jw7OdC.rst [deleted file]
Modules/_gdbmmodule.c

index 140ca5c1e3405a1dbacadf04cc39399ad5225b7f..7b7ac2df126b7d0868b818f16e19c7f992b3cee1 100644 (file)
@@ -275,9 +275,6 @@ functionality like crash tolerance.
       * ``'s'``: Synchronized mode.
         Changes to the database will be written immediately to the file.
       * ``'u'``: Do not lock database.
-      * ``'m'``: Do not use :manpage:`mmap(2)`.
-        This may harm performance, but improve crash tolerance.
-        .. versionadded:: next
 
       Not all flags are valid for all versions of GDBM.
       See the :data:`open_flags` member for a list of supported flag characters.
index 424e23ab3542457097653e433e8a8ec560a19932..295dc201ec0ae4bfeec26d2c6b1515cbdbfdca28 100644 (file)
@@ -315,10 +315,6 @@ dbm
   which allow to recover unused free space previously occupied by deleted entries.
   (Contributed by Andrea Oliveri in :gh:`134004`.)
 
-* Add the ``'m'`` flag for :func:`dbm.gnu.open` which allows to disable
-  the use of :manpage:`mmap(2)`.
-  This may harm performance, but improve crash tolerance.
-  (Contributed by Serhiy Storchaka in :gh:`66234`.)
 
 
 difflib
index e0b988b7b95bbd767e934ca68ffbcc84ef9f28fc..66268c42a300b5e0e65db4bbaf9369509415810a 100644 (file)
@@ -74,12 +74,12 @@ class TestGdbm(unittest.TestCase):
         # Test the flag parameter open() by trying all supported flag modes.
         all = set(gdbm.open_flags)
         # Test standard flags (presumably "crwn").
-        modes = all - set('fsum')
+        modes = all - set('fsu')
         for mode in sorted(modes):  # put "c" mode first
             self.g = gdbm.open(filename, mode)
             self.g.close()
 
-        # Test additional flags (presumably "fsum").
+        # Test additional flags (presumably "fsu").
         flags = all - set('crwn')
         for mode in modes:
             for flag in flags:
@@ -217,29 +217,6 @@ class TestGdbm(unittest.TestCase):
             create_empty_file(os.path.join(d, 'test'))
             self.assertRaises(gdbm.error, gdbm.open, filename, 'r')
 
-    @unittest.skipUnless('m' in gdbm.open_flags, "requires 'm' in open_flags")
-    def test_nommap_no_crash(self):
-        self.g = g = gdbm.open(filename, 'nm')
-        os.truncate(filename, 0)
-
-        g.get(b'a', b'c')
-        g.keys()
-        g.firstkey()
-        g.nextkey(b'a')
-        with self.assertRaises(KeyError):
-            g[b'a']
-        with self.assertRaises(gdbm.error):
-            len(g)
-
-        with self.assertRaises(gdbm.error):
-            g[b'a'] = b'c'
-        with self.assertRaises(gdbm.error):
-            del g[b'a']
-        with self.assertRaises(gdbm.error):
-            g.setdefault(b'a', b'c')
-        with self.assertRaises(gdbm.error):
-            g.reorganize()
-
 
 if __name__ == '__main__':
     unittest.main()
diff --git a/Misc/NEWS.d/next/Library/2025-06-01-15-13-07.gh-issue-66234.Jw7OdC.rst b/Misc/NEWS.d/next/Library/2025-06-01-15-13-07.gh-issue-66234.Jw7OdC.rst
deleted file mode 100644 (file)
index 1defb9a..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-Add the ``'m'`` flag for :func:`dbm.gnu.open` which allows to disable the
-use of :manpage:`mmap(2)`. This may harm performance, but improve crash
-tolerance.
index 7bef6ae7f0c43eceda56f238da8e4c73f8781019..a4bc0a0f675530625fb593dfd34d214c6ccf789b 100644 (file)
@@ -807,11 +807,6 @@ dbmopen_impl(PyObject *module, PyObject *filename, const char *flags,
             case 'u':
                 iflags |= GDBM_NOLOCK;
                 break;
-#endif
-#ifdef GDBM_NOMMAP
-            case 'm':
-                iflags |= GDBM_NOMMAP;
-                break;
 #endif
             default:
                 PyErr_Format(state->gdbm_error,
@@ -845,9 +840,6 @@ static const char gdbmmodule_open_flags[] = "rwcn"
 #endif
 #ifdef GDBM_NOLOCK
                                      "u"
-#endif
-#ifdef GDBM_NOMMAP
-                                     "m"
 #endif
                                      ;