This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Marco Sulla
Recipients Marco Sulla, benjamin.peterson, bup, jdemeyer, rhettinger, scoder, serhiy.storchaka
Date 2020-02-26.19:11:37
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1582744297.78.0.431097341125.issue34396@roundup.psfhosted.org>
In-reply-to
Content
I asked why on StackOverflow, and an user seemed to find the reason. The problem for him/her is in `update_one_slot()`. 

`dict` implements directly `__contains__()` and `__getitem__()`. Usually, `sq_contains` and `mp_subscript` are wrapped to implement `__contains__()` and `__getitem__()`, but this way `dict` is a little faster.

The problem is that `update_one_slot()` searches for the wrappers. If it does not find them, it does not inherit the `__contains__()` and `__getitem__()` of the class, but create a `__contains__()` and `__getitem__()` functions that do an MRO search and call the superclass method. This is why `__contains__()` and `__getitem__()` of `dict` subclasses are slower.


Is it possible to modify `update_one_slot()` so that, if no wrapper is found, the explicit implementation is inherited?

SO answer: https://stackoverflow.com/a/59914459/1763602
History
Date User Action Args
2020-02-26 19:11:37Marco Sullasetrecipients: + Marco Sulla, rhettinger, scoder, benjamin.peterson, serhiy.storchaka, jdemeyer, bup
2020-02-26 19:11:37Marco Sullasetmessageid: <1582744297.78.0.431097341125.issue34396@roundup.psfhosted.org>
2020-02-26 19:11:37Marco Sullalinkissue34396 messages
2020-02-26 19:11:37Marco Sullacreate