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 Mark.Shannon
Recipients Mark.Shannon, brandtbucher, pablogsal
Date 2021-11-17.09:50:10
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1637142611.15.0.521267590311.issue45829@roundup.psfhosted.org>
In-reply-to
Content
We can remove the C stack use and general overhead of calling special methods implemented in Python for attribute access and indexing.

Each operation has a special method that implements it. When that special method is implemented in Python, we should avoid the `tp_xxx` slot machinery and use the same mechanism we use for normal calls to Python functions. 

* BINARY_SUBSCR: `__getitem__`
* STORE_SUBSCR: `__setitem__`
* LOAD_ATTR: `__getattribute__` (and maybe `__getattr__`)
* STORE_ATTR: `__setattr__`

It probably isn't worth bothering with the deletion forms.

The getters (`__getitem__` and `__getattribute__`) are relatively simple, as the call returns the result.

The setters are a bit more complicated as the return value needs to be discarded, so an additional frame which discards the result of the call needs to be inserted.
History
Date User Action Args
2021-11-17 09:50:11Mark.Shannonsetrecipients: + Mark.Shannon, pablogsal, brandtbucher
2021-11-17 09:50:11Mark.Shannonsetmessageid: <1637142611.15.0.521267590311.issue45829@roundup.psfhosted.org>
2021-11-17 09:50:11Mark.Shannonlinkissue45829 messages
2021-11-17 09:50:10Mark.Shannoncreate