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

User code should not be able to rebind gc.garbage #53714

Closed
pitrou opened this issue Aug 4, 2010 · 2 comments
Closed

User code should not be able to rebind gc.garbage #53714

pitrou opened this issue Aug 4, 2010 · 2 comments
Labels
easy stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error

Comments

@pitrou
Copy link
Member

pitrou commented Aug 4, 2010

BPO 9505
Nosy @tim-one, @pitrou

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = <Date 2010-08-04.15:08:01.105>
created_at = <Date 2010-08-04.10:25:14.781>
labels = ['easy', 'type-bug', 'library']
title = 'User code should not be able to rebind gc.garbage'
updated_at = <Date 2010-08-04.15:08:01.104>
user = 'https://github.com/pitrou'

bugs.python.org fields:

activity = <Date 2010-08-04.15:08:01.104>
actor = 'pitrou'
assignee = 'none'
closed = True
closed_date = <Date 2010-08-04.15:08:01.105>
closer = 'pitrou'
components = ['Library (Lib)']
creation = <Date 2010-08-04.10:25:14.781>
creator = 'pitrou'
dependencies = []
files = []
hgrepos = []
issue_num = 9505
keywords = ['easy']
message_count = 2.0
messages = ['112785', '112818']
nosy_count = 2.0
nosy_names = ['tim.peters', 'pitrou']
pr_nums = []
priority = 'normal'
resolution = 'rejected'
stage = 'needs patch'
status = 'closed'
superseder = None
type = 'behavior'
url = 'https://bugs.python.org/issue9505'
versions = ['Python 3.2']

@pitrou
Copy link
Member Author

pitrou commented Aug 4, 2010

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[:] = []

@pitrou pitrou added stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error easy labels Aug 4, 2010
@pitrou
Copy link
Member Author

pitrou commented Aug 4, 2010

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.

@pitrou pitrou closed this as completed Aug 4, 2010
@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
easy stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

1 participant