bpo-33901: Add _gdbm._GDBM_VERSION (GH-7794) · pythoncapi/cpython@00f9edb · GitHub
Skip to content

Commit 00f9edb

Browse files
authored
bpo-33901: Add _gdbm._GDBM_VERSION (pythonGH-7794)
* Fix also PyInit__gdbm() to catch errors. * test.pythoninfo: add gdbm.version * test_dbm_gnu now logs GDBM_VERSION when run in verbose mode. * pythoninfo: rename function to collect_gdbm()
1 parent 06fe77a commit 00f9edb

3 files changed

Lines changed: 52 additions & 8 deletions

File tree

Lib/test/pythoninfo.py

Lines changed: 10 additions & 0 deletions

Lib/test/test_dbm_gnu.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,17 @@
88
filename = TESTFN
99

1010
class TestGdbm(unittest.TestCase):
11+
@staticmethod
12+
def setUpClass():
13+
if support.verbose:
14+
try:
15+
import _gdbm
16+
version = _gdbm._GDBM_VERSION
17+
except (ImportError, AttributeError):
18+
pass
19+
else:
20+
print(f"gdbm version: {version}")
21+
1122
def setUp(self):
1223
self.g = None
1324

Modules/_gdbmmodule.c

Lines changed: 31 additions & 8 deletions

0 commit comments

Comments
 (0)