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?
- We create a
dict by any existing C-API functions for PyDict_*.
- Then we call
PyDict_AsFrozenDictAndClear which creates new frozendict instance from the existing dict with O(1) complexity
- It clears the initial
dict and it can be decrefed by the caller if needed
Linked PRs
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?
dictby any existing C-API functions forPyDict_*.PyDict_AsFrozenDictAndClearwhich creates newfrozendictinstance from the existingdictwith O(1) complexitydictand it can be decrefed by the caller if neededLinked PRs
PyDict_AsFrozenDictAndClearC-API #153413