Author mdk
Recipients abarry, mdk, serhiy.storchaka, sjpalt
Date 2016-12-04.22:51:04
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1480891864.43.0.245529650919.issue28866@psf.upfronthosting.co.za>
In-reply-to
Content
Problem looks mainly due to the __setattr__ done on a different type than the getattr, and the cache of PyType_Lookup:

 - type_setattro will be called with Foo, "x", and the value to set
 - type_getattro will be called with FooProxy, "x"

The timeline (with my weird_without_interactive.py) is:

 - type_setattro is called on Foo for attr "x" with the instance of Bar
 - type_getattro is called on FooProxy for attr "x" (the `proxy.x` line)
     During this type_getattro, the instance of Bar is cached in PyType_Lookup for (FooProxy, "x")
 - type_setattro is called on Foo for attr "x" with the value 0
     During this call, insertdict will legitimately call DECREF on the Bar instance, which is deleted
 - type_getattro is called on FooProxy with attr "x" for the print()
     During this call, PyType_Lookup will cache hit for (FooProxy, x) with the old reference to the instance of Bar
History
Date User Action Args
2016-12-04 22:51:04mdksetrecipients: + mdk, serhiy.storchaka, abarry, sjpalt
2016-12-04 22:51:04mdksetmessageid: <1480891864.43.0.245529650919.issue28866@psf.upfronthosting.co.za>
2016-12-04 22:51:04mdklinkissue28866 messages
2016-12-04 22:51:04mdkcreate