summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
Diffstat (limited to 'Doc')
-rw-r--r--Doc/library/dbm.rst27
-rw-r--r--Doc/whatsnew/3.8.rst5
2 files changed, 26 insertions, 6 deletions
diff --git a/Doc/library/dbm.rst b/Doc/library/dbm.rst
index 32e80b2..1abc36c 100644
--- a/Doc/library/dbm.rst
+++ b/Doc/library/dbm.rst
@@ -339,9 +339,23 @@ The module defines the following:
dumbdbm database is created, files with :file:`.dat` and :file:`.dir` extensions
are created.
- The optional *flag* argument supports only the semantics of ``'c'``
- and ``'n'`` values. Other values will default to database being always
- opened for update, and will be created if it does not exist.
+ The optional *flag* argument can be:
+
+ +---------+-------------------------------------------+
+ | Value | Meaning |
+ +=========+===========================================+
+ | ``'r'`` | Open existing database for reading only |
+ | | (default) |
+ +---------+-------------------------------------------+
+ | ``'w'`` | Open existing database for reading and |
+ | | writing |
+ +---------+-------------------------------------------+
+ | ``'c'`` | Open database for reading and writing, |
+ | | creating it if it doesn't exist |
+ +---------+-------------------------------------------+
+ | ``'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
@@ -351,9 +365,10 @@ The module defines the following:
:func:`.open` always creates a new database when the flag has the value
``'n'``.
- .. deprecated-removed:: 3.6 3.8
- Creating database in ``'r'`` and ``'w'`` modes. Modifying database in
- ``'r'`` mode.
+ .. versionchanged:: 3.8
+ A database opened with flags ``'r'`` is now read-only. Opening with
+ flags ``'r'`` and ``'w'`` no longer creates a database if it does not
+ exist.
In addition to the methods provided by the
:class:`collections.abc.MutableMapping` class, :class:`dumbdbm` objects
diff --git a/Doc/whatsnew/3.8.rst b/Doc/whatsnew/3.8.rst
index c4063ad..60f54a0 100644
--- a/Doc/whatsnew/3.8.rst
+++ b/Doc/whatsnew/3.8.rst
@@ -130,3 +130,8 @@ Changes in the Python API
arguments for changing the selection was deprecated in Python 3.6. Use
specialized methods like :meth:`~tkinter.ttk.Treeview.selection_set` for
changing the selection. (Contributed by Serhiy Storchaka in :issue:`31508`.)
+
+* A :mod:`dbm.dumb` database opened with flags ``'r'`` is now read-only.
+ :func:`dbm.dumb.open` with flags ``'r'`` and ``'w'`` no longer creates
+ a database if it does not exist.
+ (Contributed by Serhiy Storchaka in :issue:`32749`.)