Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[3.8] bpo-38395: Fix ownership in weakref.proxy methods (GH-16632) #16662

Merged
merged 1 commit into from
Oct 8, 2019

Commits on Oct 8, 2019

  1. [3.8] bpo-38395: Fix ownership in weakref.proxy methods (pythonGH-16632)

    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..
    (cherry picked from commit 10cd00a)
    
    Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
    pablogsal committed Oct 8, 2019
    Configuration menu
    Copy the full SHA
    edb01a6 View commit details
    Browse the repository at this point in the history