Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork34.2k
gh-141510: Always return a dict in PyDict_Copy()#145517
gh-141510: Always return a dict in PyDict_Copy()#145517vstinner wants to merge 3 commits intopython:mainfrom
Conversation
* PyDict_Copy() now also returns a dict if the argument is a frozendict.* Remove _PyDict_CopyAsDict() function.* Fix frozendict.items() ^ frozendict.items(). Add non-regression test.
vstinner commentedMar 4, 2026
I propose changing Example in staticPyTypeObject*type_new_init(type_new_ctx*ctx){PyObject*dict=PyDict_Copy(ctx->orig_dict);if (dict==NULL) { gotoerror; } ...set_tp_dict(type,dict); ...} The function accepts Example in staticPyObject*get_attrib_from_keywords(PyObject*kwds){ ...if (attrib) { ...Py_SETREF(attrib,PyDict_Copy(attrib)); }else {attrib=PyDict_New(); }if (attrib!=NULL&&PyDict_Update(attrib,kwds)<0) {Py_DECREF(attrib);returnNULL; }returnattrib;} (With my pending change PRgh-145508), the function accepts |
vstinner commentedMar 4, 2026
Currently, Existing C extensions calling Always returning |
Uh oh!
There was an error while loading.Please reload this page.
📚 Documentation preview 📚:https://cpython-previews--145517.org.readthedocs.build/