Skip to content

gh-112075: Remove _PyObject_SetManagedDict() function - #139737

Merged
vstinner merged 1 commit into
python:mainfrom
vstinner:remove_set_managed_dict
Oct 12, 2025
Merged

vstinner merged 1 commit into
python:mainfrom
vstinner:remove_set_managed_dict

Conversation

@vstinner

@vstinner vstinner commented Oct 7, 2025 •

Copy link
Copy Markdown
Member

Move it to the internal C API and no longer export it.

Move it to the internal C API and no longer export it.
@vstinner

vstinner commented Oct 7, 2025

Copy link
Copy Markdown
Member Author

The _PyObject_SetManagedDict() function is private, not documented, and not tested.

It's used by _PyObject_SetDict() which belongs to the internal C API and is not exported.

A code search in PyPI top 15,000 projects did not find any project using it.

The function was added by commit 8b541c0.

@DinoV: Did you add this function to the public C API on purpose?

cc @colesbury who modified the function.

@vstinner

Copy link
Copy Markdown
Member Author

Well, let me remove this function. It can be added back easily if things go wrong.

It's used by _PyObject_SetDict() which belongs to the internal C API and is not exported.

See also #139852 discussion about _PyObject_GetDictPtr() and maybe adding an idea to set the dictionary.

@vstinner
vstinner merged commit 5f91d5d into python:main Oct 12, 2025
@vstinner
vstinner deleted the remove_set_managed_dict branch October 12, 2025 17:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

1 participant