Skip to content

Commit 66552f0

Browse files
author
Erlend E. Aasland
committed
Add gdbm test
1 parent 7fb93a9 commit 66552f0

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

Lib/test/test_dbm_gnu.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from test import support
2-
from test.support import import_helper
2+
from test.support import import_helper, cpython_only
33
gdbm = import_helper.import_module("dbm.gnu") #skip if not supported
44
import unittest
55
import os
@@ -27,6 +27,13 @@ def tearDown(self):
2727
self.g.close()
2828
unlink(filename)
2929

30+
@cpython_only
31+
def test_uninitialised_new(self):
32+
# Prevent heap types from being created uninitialised (bpo-43916)
33+
self.g = gdbm.open(filename, 'c')
34+
tp = type(self.g)
35+
self.assertRaises(TypeError, tp)
36+
3037
def test_key_methods(self):
3138
self.g = gdbm.open(filename, 'c')
3239
self.assertEqual(self.g.keys(), [])

0 commit comments

Comments
 (0)