Skip to content

Add PyDict_AsFrozenDictAndClear C-API #153410

Description

@sobolevn

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

Linked PRs

Metadata

Metadata

Assignees

Labels

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions