[issue18181] Add type.__locallookup__
Ronald Oussoren
report at bugs.python.org
Wed Jul 17 16:57:53 CEST 2013
Ronald Oussoren added the comment:
issue-18181-full-v1.txt implements support for __locallookup__ to both super and _PyType_Lookup and should implement the entire PEP.
The patch is not yet 100% and is missing:
* Tests that add __locallookup__ to a metaclass at runtime, should
enable the new behavior
* Tests that use the tp_locallookup slot in an type defined in C code
* Documentation has not been updated.
Changes to the implementation:
* _PyType_Lookup is now _PyType_LookupName
and returns a new reference (not a borrowed one)
* _PyType_Lookup and super.__getattribute__ use the
__locallookup__ method when present
* __locallookup__ is not defined on "type",
and the type attribute lookup cache is disabled
for types that have a metatype with __locallookup__
* The type attribute cache is disabled for types that are
not ready (Py_TPFLAGS_READY), primarily
as a side effect of the implementation.
The cache is also disabled for types with a metaclass that
has a tp_locallookup attribute, as mentioned in the PEP.
The code does not change the VERSION flags of the type because
dynamicly adding a __locallookup__ method to the metaclass would
have to change all instances of that metaclass and that's not
easily possible.
----------
stage: needs patch -> patch review
title: super vs. someclass.__getattribute__ -> Add type.__locallookup__
Added file: http://bugs.python.org/file30951/issue-18181-full-v1.txt
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue18181>
_______________________________________
More information about the Python-bugs-list
mailing list