https://github.com/python/cpython/commit/eea2af3dd8aff101bbe8e4d5622ec42cd94a1d89
commit: eea2af3dd8aff101bbe8e4d5622ec42cd94a1d89
branch: 3.13
author: Miss Islington (bot) <31488909+miss-isling...@users.noreply.github.com>
committer: serhiy-storchaka <storch...@gmail.com>
date: 2025-07-07T12:50:40Z
summary:

[3.13] gh-124486: Fix test_whichdb_ndbm in test_dbm on NetBSD (GH-136335) 
(GH-136379)

On NetBSD, ndbm.open() does not fail for empty file.
(cherry picked from commit b7aa2a4b4df697db6ea45a555eeb3fefa5ca5bd4)

Co-authored-by: Serhiy Storchaka <storch...@gmail.com>

files:
M Lib/test/test_dbm.py

diff --git a/Lib/test/test_dbm.py b/Lib/test/test_dbm.py
index 4be7c5649da68a..6785aa273ac7db 100644
--- a/Lib/test/test_dbm.py
+++ b/Lib/test/test_dbm.py
@@ -213,7 +213,8 @@ def test_whichdb(self):
     @unittest.skipUnless(ndbm, reason='Test requires ndbm')
     def test_whichdb_ndbm(self):
         # Issue 17198: check that ndbm which is referenced in whichdb is 
defined
-        with open(_fname + '.db', 'wb'): pass
+        with open(_fname + '.db', 'wb') as f:
+            f.write(b'spam')
         _bytes_fname = os.fsencode(_fname)
         fnames = [_fname, os_helper.FakePath(_fname),
                   _bytes_fname, os_helper.FakePath(_bytes_fname)]

_______________________________________________
Python-checkins mailing list -- python-checkins@python.org
To unsubscribe send an email to python-checkins-le...@python.org
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: arch...@mail-archive.com

Reply via email to