Message199133
@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. |
|
Date |
User |
Action |
Args |
2013-10-07 09:55:05 | shishkander | set | recipients:
+ shishkander, tim.peters, ncoghlan, grahamd |
2013-10-07 09:55:05 | shishkander | set | messageid: <1381139705.74.0.0269037815187.issue19070@psf.upfronthosting.co.za> |
2013-10-07 09:55:05 | shishkander | link | issue19070 messages |
2013-10-07 09:55:05 | shishkander | create | |
|