# Feature or enhancement Discussion: https://discuss.python.org/t/provide-a-c-api-to-efficently-convert-dict-into-frozendict/107754/10 Looks like that all agree that this API would be useful. How it works? 1. We create a `dict` by any existing C-API functions for `PyDict_*`. 2. Then we call `PyDict_AsFrozenDictAndClear` which creates new `frozendict` instance from the existing `dict` with O(1) complexity 3. It clears the initial `dict` and it can be decrefed by the caller if needed <!-- gh-linked-prs --> ### Linked PRs * gh-153413 <!-- /gh-linked-prs -->
Activity
pythongh-153410: Add `PyDict_AsFrozenDictAndClear` C-API