Skip to content

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

Merged
ambv merged 2 commits into
python:mainfrom
serhiy-storchaka:ordered_dict_subclass_pop2
Aug 3, 2021
Merged

bpo-27275: Change popitem() and pop() methods of collections.OrderedDict#27530
ambv merged 2 commits into
python:mainfrom
serhiy-storchaka:ordered_dict_subclass_pop2

Conversation

@serhiy-storchaka
Copy link
Copy Markdown
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
Copy Markdown
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.

@mhvk
Copy link
Copy Markdown

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.

5 participants