Skip to content

Commit 4bbaea2

Browse files
committed
Address review
1 parent acd868a commit 4bbaea2

2 files changed

Lines changed: 10 additions & 6 deletions

File tree

Doc/c-api/dict.rst

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -510,14 +510,18 @@ Dictionary objects
510510
.. c:function:: PyObject* PyDict_AsFrozenDictAndClear(PyObject *dict)
511511
512512
Return a new :class:`frozendict` created
513-
from the existing :c:type:`PyDictObject` instance.
513+
from the existing :class:`dict` instance.
514514
Expects *dict* to be an exact :class:`dict` instance.
515515
516516
Transfers all keys and values from *dict*
517-
to the newly allocated :class:`!frozendict` with O(1) complexity.
517+
to the newly allocated :class:`!frozendict`.
518518
Clears the input *dict* on success.
519519
Returns ``NULL`` with the exception set on error.
520520
521+
.. impl-detail::
522+
523+
Works with O(1) complexity.
524+
521525
.. versionadded:: next
522526
523527

Lib/test/test_capi/test_dict.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -611,18 +611,18 @@ def test_dict_popstring(self):
611611

612612
def test_dict_as_frozendict_and_clear(self):
613613
# Test PyDict_AsFrozenDictAndClear()
614-
check = _testcapi.dict_as_frozendict_and_clear
614+
as_frozendict = _testcapi.dict_as_frozendict_and_clear
615615
d = {1: 2, 'a': 'b'}
616-
f = check(d)
616+
f = as_frozendict(d)
617617
self.assertIs(type(f), frozendict)
618618
self.assertEqual(f, frozendict({1: 2, 'a': 'b'}))
619619
self.assertIs(type(d), dict)
620620
self.assertEqual(d, {})
621621

622622
d = {}
623-
f = check(d)
623+
f = as_frozendict(d)
624624
self.assertIs(type(f), frozendict)
625-
self.assertEqual(f, {})
625+
self.assertEqual(f, frozendict())
626626
self.assertIs(type(d), dict)
627627
self.assertEqual(d, {})
628628
# CRASHES check([])

0 commit comments

Comments
 (0)