• Pablo Galindo's avatar
    bpo-38395: Fix ownership in weakref.proxy methods (GH-16632) · 10cd00a9
    Pablo Galindo authored
    The implementation of weakref.proxy's methods call back into the Python
    API using a borrowed references of the weakly referenced object
    (acquired via PyWeakref_GET_OBJECT). This API call may delete the last
    reference to the object (either directly or via GC), leaving a dangling
    pointer, which can be subsequently dereferenced.
    
    To fix this, claim a temporary ownership of the referenced object when
    calling the appropriate method. Some functions because at the moment they
    do not need to access the borrowed referent, but to protect against
    future changes to these functions, ownership need to be fixed in
    all potentially affected methods.
    10cd00a9
2019-10-08-01-23-24.bpo-38395.MJ6Ey9.rst 220 Bytes