Visitar URL original
bpo-27275: Change popitem() and pop() methods of collections.OrderedDict by serhiy-storchaka · Pull Request #27530 · python/cpython · GitHub
The Wayback Machine - https://web.archive.org/web/20221223184707/https://github.com/python/cpython/pull/27530
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bpo-27275: Change popitem() and pop() methods of collections.OrderedDict #27530

Merged
merged 2 commits into from Aug 3, 2021

Conversation

serhiy-storchaka
Copy link
Member

@serhiy-storchaka serhiy-storchaka commented Aug 1, 2021 •

For consistency with dict both implementations (pure Python and C)
of these methods in OrderedDict no longer call __getitem__ and
__delitem__ methods of the OrderedDict subclasses.

Previously only the Python implementation of popitem() did not
call them.

https://bugs.python.org/issue27275

…tem().

The C implementation no longer calls ``__getitem__`` and ``__delitem__``
methods of the OrderedDict subclasses.
For consistency with dict both implementations (pure Python and C)
of these methods in OrderedDict no longer call __getitem__ and
__delitem__ methods of the OrderedDict subclasses.

Previously only the Python implementation of popitem() did not
call them.
@ambv
Copy link
Contributor

ambv commented Aug 3, 2021

Based on Raymond's comment on the issue, we won't be backporting this as it's a behavioral change and there haven't been reports complaining of the old behavior.

@ambv ambv merged commit 8c9f847 into python:main Aug 3, 2021
13 checks passed
@serhiy-storchaka serhiy-storchaka deleted the ordered_dict_subclass_pop2 branch Aug 3, 2021
@mhvk
Copy link

mhvk commented Sep 11, 2022

See astropy/astropy#13637 for a regression caused by this change. We may be able to work around this, but on the other hand we're unlikely to be the only project that counts on __delitem__ being called when something is being pop'd.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants