Message179530
Looks like a case where the concrete dict API is ignoring subtype implementations.
In your example the attribute access will be handled by a LOAD_ATTR which calls PyObject_GetAttr() (Python/ceval.c:2369). That ends up calling PyFunction_Type.tp_getattro (inherited from PyBaseObject_Type).
That ends up just being PyObject_GenericGetAttr() (Objects/object.c:1061). The dict gets pulled from foo using PyFunction_Type.->tp_dictoffset and then PyDict_GetItem() gets called on it.
Unfortunately, PyDict_GetItem() is hard-coded to the dict implementation. At this point your __getitem__() has been entirely circumvented!
FYI, this is a pain point for myself right now so it's been on my mind (COrderedDict and kwargs). This came up in 2011. See issue 10977. |
|
Date |
User |
Action |
Args |
2013-01-10 07:42:18 | eric.snow | set | recipients:
+ eric.snow, brett.cannon, alex, dabeaz |
2013-01-10 07:42:18 | eric.snow | set | messageid: <1357803738.76.0.563936077039.issue16894@psf.upfronthosting.co.za> |
2013-01-10 07:42:18 | eric.snow | link | issue16894 messages |
2013-01-10 07:42:18 | eric.snow | create | |
|