Eryk Sun added the comment:
> the sq_length slot in the weakproxy type is set to proxy_length.
Nice. Its tp_getattro gets in the way of using __len__ directly, but this can
be side stepped by manually binding the descriptor:
class Test(object):
def __len__(self):
return 2**31 + 5
>>> t = Test()
>>> p = weakref.proxy(t)
>>> p.__len__()
2147483653L
>>> type(p).__len__.__get__(p)()
-2147483643
----------
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue26423>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com