[issue19070] In place operators of weakref.proxy() not returning self.

shishkander report at bugs.python.org
Mon Oct 7 08:10:30 CEST 2013


shishkander added the comment:

This bug happens not just with operators, but with any call self.call_something()! For example, running this:

    from __future__ import print_function
    import weakref

    class Test(object):
        def method(self):
            return type(self)

    def test(obj):
        print(type(obj), "=>", obj.method())

    o = Test()
    test(o)
    test(weakref.proxy(o))


(also attached for convenience as t.py) 
produces in both python2.7 and python3.2:

$ python t.py 
<class '__main__.Test'> => <class '__main__.Test'>
<type 'weakproxy'> => <class '__main__.Test'>

----------
nosy: +shishkander
Added file: http://bugs.python.org/file31983/t.py

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


More information about the Python-bugs-list mailing list