-
-
Notifications
You must be signed in to change notification settings - Fork 34.2k
Description
Feature or enhancement
Proposal:
After discussion on PR #145362, it became clear that there are many possibilities for unintended mutations in the partialobject in Module/_functoolsmodule.c, particularly for the kw dictionary for keywords. Thus, changing kw to be a frozendict could prevent any unintended consequences.
Additionally, right now, the keys of kw could be an arbitrary PyObject, leading to unintended code execution if they are not strings. Thus, enforcing that the entries are strings could solve any future problems (similar to what happened in #145362).
Lastly, Issue #145446 also makes sure that there are no unintended mutations in the functools internals for free-threading, but changing to using a frozendict would be a more robust solution.
I will work on this and create a PR in the next couple of days. I will wait until #145446 is resolved to avoid any conflicts.
Has this already been discussed elsewhere?
This is a minor feature, which does not need previous discussion elsewhere