diff --git a/Doc/library/dbm.rst b/Doc/library/dbm.rst --- a/Doc/library/dbm.rst +++ b/Doc/library/dbm.rst @@ -217,16 +217,20 @@ supported. reorganization; otherwise, deleted file space will be kept and reused as new (key, value) pairs are added. .. method:: gdbm.sync() When the database has been opened in fast mode, this method forces any unwritten data to be written to the disk. + .. method:: gdbm.close() + + Close the ``gdbm`` database. + :mod:`dbm.ndbm` --- Interface based on ndbm ------------------------------------------- .. module:: dbm.ndbm :platform: Unix :synopsis: The standard "database" interface, based on ndbm. @@ -248,17 +252,17 @@ to locate the appropriate header file to .. data:: library Name of the ``ndbm`` implementation library used. .. function:: open(filename[, flag[, mode]]) - Open a dbm database and return a ``dbm`` object. The *filename* argument is the + Open a dbm database and return a ``ndbm`` object. The *filename* argument is the name of the database file (without the :file:`.dir` or :file:`.pag` extensions). The optional *flag* argument must be one of these values: +---------+-------------------------------------------+ | Value | Meaning | +=========+===========================================+ | ``'r'`` | Open existing database for reading only | @@ -273,16 +277,22 @@ to locate the appropriate header file to | ``'n'`` | Always create a new, empty database, open | | | for reading and writing | +---------+-------------------------------------------+ The optional *mode* argument is the Unix mode of the file, used only when the database has to be created. It defaults to octal ``0o666`` (and will be modified by the prevailing umask). + In addition to the dictionary-like methods, ``ndbm`` objects provide the + following method: + + .. method:: ndbm.close() + + Close the ``ndbm`` database. :mod:`dbm.dumb` --- Portable DBM implementation ----------------------------------------------- .. module:: dbm.dumb :synopsis: Portable implementation of the simple DBM interface. @@ -320,14 +330,18 @@ The module defines the following: for update, and will be created if it does not exist. The optional *mode* argument is the Unix mode of the file, used only when the database has to be created. It defaults to octal ``0o666`` (and will be modified by the prevailing umask). In addition to the methods provided by the :class:`collections.abc.MutableMapping` class, :class:`dumbdbm` objects - provide the following method: + provide the following methods: .. method:: dumbdbm.sync() Synchronize the on-disk directory and data files. This method is called - by the :meth:`Shelve.sync` method. + by the :meth:`Shelf.sync ` method. + + .. method:: dumbdbm.close() + + Close the ``dumbdbm`` database.