Staging
v0.8.1
https://github.com/python/cpython
Revision 193366e25c4f84a58d2f6c6c577fd9f0143dc6e1 authored by Pablo Galindo on 11 October 2019, 20:28:49 UTC, committed by Miss Islington (bot) on 11 October 2019, 20:28:49 UTC


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 10cd00a9e3c22af37c748ea5a417f6fb66601e21)

Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>





https://bugs.python.org/issue38395
1 parent 1845997
History
Tip revision: 193366e25c4f84a58d2f6c6c577fd9f0143dc6e1 authored by Pablo Galindo on 11 October 2019, 20:28:49 UTC
[3.7] bpo-38395: Fix ownership in weakref.proxy methods (GH-16632) (GH-16663)
Tip revision: 193366e
File Mode Size
.azure-pipelines
.github
Doc
Grammar
Include
Lib
Mac
Misc
Modules
Objects
PC
PCbuild
Parser
Programs
Python
Tools
m4
.gitattributes -rw-r--r-- 1.6 KB
.gitignore -rw-r--r-- 1.5 KB
.travis.yml -rw-r--r-- 6.1 KB
CODE_OF_CONDUCT.rst -rw-r--r-- 631 bytes
LICENSE -rw-r--r-- 12.5 KB
Makefile.pre.in -rw-r--r-- 62.5 KB
README.rst -rw-r--r-- 9.7 KB
aclocal.m4 -rw-r--r-- 10.7 KB
config.guess -rwxr-xr-x 43.1 KB
config.sub -rwxr-xr-x 35.4 KB
configure -rwxr-xr-x 491.1 KB
configure.ac -rw-r--r-- 164.0 KB
install-sh -rwxr-xr-x 7.0 KB
pyconfig.h.in -rw-r--r-- 42.2 KB
setup.py -rw-r--r-- 101.3 KB

README.rst

back to top