[issue19359] reversed() does not work with weakref.proxy of sequences

Antoine Pitrou report at bugs.python.org
Fri Mar 14 11:11:48 CET 2014


Antoine Pitrou added the comment:

Another possible idea is to introduce a "proxy protocol" (__proxy__ /
tp_proxy) that would be used as a fallback by PyObject_LookupSpecial to
fetch the lookup target, i.e.:

def PyObject_LookupSpecial(obj, name):
    tp = type(obj)
    try:
        return getattr(tp, name)
    except AttributeError:
        return getattr(tp.tp_proxy(), name)

(not sure that makes sense, I haven't thought very hard about it)

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue19359>
_______________________________________


More information about the Python-bugs-list mailing list