This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author shishkander
Recipients grahamd, ncoghlan, shishkander, tim.peters
Date 2013-10-07.09:55:05
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1381139705.74.0.0269037815187.issue19070@psf.upfronthosting.co.za>
In-reply-to
Content
@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.
History
Date User Action Args
2013-10-07 09:55:05shishkandersetrecipients: + shishkander, tim.peters, ncoghlan, grahamd
2013-10-07 09:55:05shishkandersetmessageid: <1381139705.74.0.0269037815187.issue19070@psf.upfronthosting.co.za>
2013-10-07 09:55:05shishkanderlinkissue19070 messages
2013-10-07 09:55:05shishkandercreate