Skip to content

gh-162047: Add PyFrozenDict_New() to the limited C API - #162048

Open
vstinner wants to merge 6 commits into
python:mainfrom
vstinner:limited_frozendict
Open

vstinner wants to merge 6 commits into
python:mainfrom
vstinner:limited_frozendict

Conversation

@vstinner

@vstinner vstinner commented Nov 15, 2026 •

Copy link
Copy Markdown
Member

Add PEP 814 frozendict functions to the limited C API:

  • PyAnyDict_Check()
  • PyAnyDict_CheckExact()
  • PyFrozenDict_Check()
  • PyFrozenDict_CheckExact()
  • PyFrozenDict_New()

Move test wrappers from _testcapi to _testlimitedcapi.

Add PEP 814 frozendict functions to the limited C API:

* PyAnyDict_Check()
* PyAnyDict_CheckExact()
* PyFrozenDict_Check()
* PyFrozenDict_CheckExact()
* PyFrozenDict_New()

Move test wrappers from _testcapi to _testlimitedcapi.
@read-the-docs-community

read-the-docs-community Bot commented Nov 15, 2026 •

Copy link
Copy Markdown

Documentation build overview

📚 cpython-previews | 🛠️ Build #35999337 | 📁 Comparing 386706b against main (369d8bc)

  🔍 Preview build  

12 files changed · + 1 added · ± 11 modified

+ Added

± Modified

@vstinner
vstinner requested a review from a team as a code owner November 16, 2026 17:07
@vstinner

Copy link
Copy Markdown
Member Author

test_capi failed on Sanitizers / TSan (free-threading): it's an unrelated issue, see #162144.

@vstinner

Copy link
Copy Markdown
Member Author

@encukou: Would you mind to review this change?

@vstinner

Copy link
Copy Markdown
Member Author

test_capi failed on Sanitizers / TSan (free-threading): it's an unrelated issue, see #162144.

The TSan fix has been merged. I updated the branch to retrieve the fix.

@encukou

encukou commented Nov 18, 2026

Copy link
Copy Markdown
Member

Is there a C API issue for these?
Shouldn't PyDict_AsFrozenDictAndClear go in as well?

Technically this looks good.


I'm not happy with exposing a new PyAPI_DATA symbol (PyFrozenDict_Type), but, if capi-workgroup/decisions#115 is accepted in 3.16 we can remove it again.

@vstinner

Copy link
Copy Markdown
Member Author

Is there a C API issue for these?

I supposed that you're talking about a C API Working Group issue. I waited for feedback on this PR before that. You just provided the feedback I expected, so I created capi-workgroup/decisions#120.

Shouldn't PyDict_AsFrozenDictAndClear go in as well?

Good idea. I added it as well.

I'm not happy with exposing a new PyAPI_DATA symbol (PyFrozenDict_Type), but, if capi-workgroup/decisions#115 is accepted in 3.16 we can remove it again.

Right, it can be removed if capi-workgroup/decisions#115 lands before Python 3.16 final (in 11 months).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants