Skip to content

gh-141510: Don't accept frozendict in PyDict_Watch()#145529

Merged
vstinner merged 1 commit intopython:mainfrom
vstinner:dict_watch
Mar 5, 2026
Merged

gh-141510: Don't accept frozendict in PyDict_Watch()#145529
vstinner merged 1 commit intopython:mainfrom
vstinner:dict_watch

Conversation

@vstinner
Copy link
Member

@vstinner vstinner commented Mar 5, 2026

Don't accept frozendict in PyDict_Watch() and PyDict_Unwatch(). A frozendict cannot be modified, so it's not useful to watch for modifications.

Don't accept frozendict in PyDict_Watch() and PyDict_Unwatch(). A
frozendict cannot be modified, so it's not useful to watch for
modifications.
@vstinner
Copy link
Member Author

vstinner commented Mar 5, 2026

I don't recall why I modified PyDict_Watch() and PyDict_Unwatch() to accept frozendict in my commit 696cdfc. Maybe I just replaced mechanically PyDict_Check() with PyAnyDict_Check().

A frozendict cannot be modified, so it's not useful to watch for modifications.

If later, it becomes useful, we can modify the functions again. But I prefer to start by not accepting them.

@vstinner
Copy link
Member Author

vstinner commented Mar 5, 2026

cc @corona10 @Fidget-Spinner

@vstinner vstinner merged commit 0fe20fc into python:main Mar 5, 2026
56 checks passed
@vstinner vstinner deleted the dict_watch branch March 5, 2026 11:31
@vstinner
Copy link
Member Author

vstinner commented Mar 5, 2026

Merged. Thanks for the review @Fidget-Spinner.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants