From 78d6f175e85c6118cf8b9e22f89fadb2dc3b1996 Mon Sep 17 00:00:00 2001 From: tonghuaroot Date: Wed, 8 Jul 2026 10:12:00 +0800 Subject: [PATCH 1/2] gh-153305: Fix dbm.whichdb docstring return-value example whichdb() returns the dotted submodule name, such as "dbm.ndbm" or "dbm.gnu", matching the keys of the internal dispatch table and the values documented in Doc/library/dbm.rst. The docstring still showed the pre-package "ndbm"/"gnu" form. Correct the example. --- Lib/dbm/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Lib/dbm/__init__.py b/Lib/dbm/__init__.py index 4fdbc54e74cfb64..5b0a3770f03e61b 100644 --- a/Lib/dbm/__init__.py +++ b/Lib/dbm/__init__.py @@ -102,7 +102,8 @@ def whichdb(filename): - None if the database file can't be read; - empty string if the file can be read but can't be recognized - - the name of the dbm submodule (e.g. "ndbm" or "gnu") if recognized. + - the name of the dbm submodule (e.g. "dbm.ndbm" or "dbm.gnu") if + recognized. Importing the given module may still fail, and opening the database using that module may still fail. From 6c667eca35ea2f1d901f72595214d9e90a346ea5 Mon Sep 17 00:00:00 2001 From: tonghuaroot Date: Wed, 8 Jul 2026 15:27:59 +0800 Subject: [PATCH 2/2] Use 'for example' per documentation style guide --- Lib/dbm/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Lib/dbm/__init__.py b/Lib/dbm/__init__.py index 5b0a3770f03e61b..e3f4ce24685a936 100644 --- a/Lib/dbm/__init__.py +++ b/Lib/dbm/__init__.py @@ -102,8 +102,8 @@ def whichdb(filename): - None if the database file can't be read; - empty string if the file can be read but can't be recognized - - the name of the dbm submodule (e.g. "dbm.ndbm" or "dbm.gnu") if - recognized. + - the name of the dbm submodule (for example "dbm.ndbm" or "dbm.gnu") + if recognized. Importing the given module may still fail, and opening the database using that module may still fail.