Message378356
> Maybe I am missing something but we could mark them as having GC support unconditionally but still leave them untracking and unconditionally add a tracking call on setattribute.
Hm, I’m not sure that would be enough. Consider the case of a class that registers its instances in a collection of some sort:
while True:
class D:
__slots__ = ()
registry = []
def __init__(self):
self.registry.append(self)
for i in range(100):
D() and None # Suppress REPL output.
del D
This is probably more common (and problematic) than my example above.
At the same time, I agree that it’s not *ideal* to track all of these objects automatically. Anyone setting __slots__ is probably planning on creating lots of “cheap” instances. If they do accidentally create cycles, though, I feel the memory hit then would be worse than any collection overhead.
I’m just not sure I see a way to fix this without tracking them all. |
|
Date |
User |
Action |
Args |
2020-10-09 23:19:36 | brandtbucher | set | recipients:
+ brandtbucher, tim.peters, nascheme, pablogsal |
2020-10-09 23:19:36 | brandtbucher | set | messageid: <1602285576.48.0.594991960676.issue41984@roundup.psfhosted.org> |
2020-10-09 23:19:36 | brandtbucher | link | issue41984 messages |
2020-10-09 23:19:36 | brandtbucher | create | |
|