classification
Title: site.py keeps too much stuff alive when it patches builtins
Type: resource usage Stage: resolved
Components: Library (Lib) Versions: Python 3.4
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: pitrou, python-dev, sbt
Priority: normal Keywords: patch

Created on 2013-08-01 20:49 by pitrou, last changed 2013-08-06 20:59 by pitrou. This issue is now closed.

Files
File name Uploaded Description Edit
sitebuiltins.patch pitrou, 2013-08-01 20:49 review
Messages (3)
msg194117 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2013-08-01 20:49
The site module patches the builtins module unless Python is run with -S. Unfortunately, this means the builtins dict then keeps the site module globals alive until the end of interpreter shutdown, preventing the garbage collection of many other objects or modules.

Attached patch isolates those patched builtins inside a separate module "_sitebuiltins".
msg194572 - (view) Author: Roundup Robot (python-dev) Date: 2013-08-06 20:57
New changeset 8584f63e570e by Antoine Pitrou in branch 'default':
Issue #18621: Prevent the site module's patched builtins from keeping too many references alive for too long.
http://hg.python.org/cpython/rev/8584f63e570e
msg194573 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2013-08-06 20:59
I went ahead and committed this, so that the effect of other improvements in the area stand out better.
History
Date User Action Args
2013-08-06 20:59:05pitrousetstatus: open -> closed
resolution: fixed
messages: + msg194573

stage: patch review -> resolved
2013-08-06 20:57:38python-devsetnosy: + python-dev
messages: + msg194572
2013-08-01 20:49:56pitroucreate