Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions Lib/test/test_dict.py
Original file line number Diff line number Diff line change
Expand Up @@ -1736,6 +1736,16 @@ class FrozenDictSlots(frozendict):


class FrozenDictTests(unittest.TestCase):
def test_constructor(self):
# frozendict.__init__() has no effect
d = frozendict(a=1, b=2, c=3)
d.__init__(x=1)
self.assertEqual(d, frozendict(a=1, b=2, c=3))

# dict constructor cannot be used on frozendict
with self.assertRaises(TypeError):
dict.__init__(d, x=1)

def test_copy(self):
d = frozendict(x=1, y=2)
d2 = d.copy()
Expand Down
1 change: 0 additions & 1 deletion Objects/dictobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -8143,7 +8143,6 @@ PyTypeObject PyFrozenDict_Type = {
.tp_richcompare = dict_richcompare,
.tp_iter = dict_iter,
.tp_methods = frozendict_methods,
.tp_init = dict_init,
.tp_alloc = _PyType_AllocNoTrack,
.tp_new = frozendict_new,
.tp_free = PyObject_GC_Del,
Expand Down
Loading