classification
Title: User code should not be able to rebind gc.garbage
Type: behavior Stage: needs patch
Components: Library (Lib) Versions: Python 3.2
process
Status: closed Resolution: rejected
Dependencies: Superseder:
Assigned To: Nosy List: pitrou, tim.peters
Priority: normal Keywords: easy

Created on 2010-08-04 10:25 by pitrou, last changed 2010-08-04 15:08 by pitrou. This issue is now closed.

Messages (2)
msg112785 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2010-08-04 10:25
User code is currently allowed to rebind the gc.garbage attribute, while the "real" garbage list in the GC module actually remains the same. This is counter-intuitive and allows to write apparently correct code such as:

    gc.garbage = []

while it should really be:

    gc.garbage[:] = []
msg112818 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2010-08-04 15:08
Hmm, I was under the impression that C extensions could set properties (or special members) on modules, but they can't. This makes this issue too hard to solve compared to the expected benefit.
History
Date User Action Args
2010-08-04 15:08:01pitrousetstatus: open -> closed
resolution: rejected
messages: + msg112818
2010-08-04 10:29:51pitrousetkeywords: + easy
2010-08-04 10:25:14pitroucreate