shishkander added the comment: @grahamd In short, instead of this: $ python t.py <class '__main__.Test'> => <class '__main__.Test'> <type 'weakproxy'> => <class '__main__.Test'>
I expected to get this (note the second line): <class '__main__.Test'> => <class '__main__.Test'> <type 'weakproxy'> => <type 'weakproxy'> I pass the proxy to the test() function, and I expect the argument inside the function to be a proxy. And that works - the type of obj in test() is weakproxy. However, the test function calls obj.method(), and I expected the method to get a proxy of obj as well, but *it does not* (the type of self is now Test)! The reason I though this is the same bug is that your method doesn't work on a proxy any more! def __iadd__(self, value): # self is not longer proxy! it's actually actual class instance now. ... Now, if I call the method like this: Test.method(weakref.proxy(o)), then obviously the self argument of the method is a proxy. So, the crux of the matter is in how obj.method is handled inside Python interpreter. I think the current behavior is wrong, and if it is fixed, I'm certain your problem is fixed as well. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue19070> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com