Staging
v0.8.1
https://github.com/python/cpython
Revision dd0e087edc8f1e4d2c0913236b1a62a77d9db6d8 authored by Martin Teichmann on 28 January 2018, 04:17:46 UTC, committed by Nick Coghlan on 28 January 2018, 04:17:46 UTC
The arguments to a generator function which is declared as a
contextmanager are stored inside the context manager, and
thus are kept alive, even when it is used as a regular context
manager, and not as a function decorator (where it needs
the original arguments to recreate the generator on each
call).

This is a possible unnecessary memory leak, so this changes
contextmanager.__enter__ to release the saved arguments,
as that method being called means that particular CM instance
isn't going to need to recreate the underlying generator.

Patch by Martin Teichmann.
1 parent c4b1248
History
Tip revision: dd0e087edc8f1e4d2c0913236b1a62a77d9db6d8 authored by Martin Teichmann on 28 January 2018, 04:17:46 UTC
bpo-30306: release arguments of contextmanager (GH-1500)
Tip revision: dd0e087
File Mode Size
NEWS.d
ACKS -rw-r--r-- 25.7 KB
HISTORY -rw-r--r-- 1.3 MB
Porting -rw-r--r-- 63 bytes
README -rw-r--r-- 1.4 KB
README.AIX -rw-r--r-- 4.7 KB
README.coverity -rw-r--r-- 845 bytes
README.valgrind -rw-r--r-- 4.5 KB
SpecialBuilds.txt -rw-r--r-- 9.7 KB
coverity_model.c -rw-r--r-- 4.1 KB
gdbinit -rw-r--r-- 4.7 KB
indent.pro -rw-r--r-- 557 bytes
python-config.in -rw-r--r-- 2.0 KB
python-config.sh.in -rw-r--r-- 2.9 KB
python-wing3.wpr -rw-r--r-- 555 bytes
python-wing4.wpr -rw-r--r-- 835 bytes
python-wing5.wpr -rw-r--r-- 835 bytes
python.man -rw-r--r-- 13.1 KB
python.pc.in -rw-r--r-- 293 bytes
svnmap.txt -rw-r--r-- 4.1 MB
valgrind-python.supp -rw-r--r-- 8.2 KB
vgrindefs -rw-r--r-- 500 bytes

README

back to top