[issue41984] Empty __slots__ can create untracked reference cycles

2020-10-15 Thread Brandt Bucher
Brandt Bucher added the comment: New changeset aeb66c1abbf4ec214e2e80eb972546996d1a1571 by Miss Skeleton (bot) in branch '3.8': bpo-41984: GC track all user classes (GH-22701/GH-22707) https://github.com/python/cpython/commit/aeb66c1abbf4ec214e2e80eb972546996d1a1571 --

[issue41984] Empty __slots__ can create untracked reference cycles

2020-10-14 Thread miss-islington
Change by miss-islington : -- pull_requests: +21676 pull_request: https://github.com/python/cpython/pull/22707 ___ Python tracker ___ __

[issue41984] Empty __slots__ can create untracked reference cycles

2020-10-14 Thread Brandt Bucher
Brandt Bucher added the comment: New changeset d197b2bb3e401bed53987b65a7ceb6c712c4f5bd by Miss Skeleton (bot) in branch '3.9': bpo-41984: GC track all user classes (GH-22701/GH-22702) https://github.com/python/cpython/commit/d197b2bb3e401bed53987b65a7ceb6c712c4f5bd --

[issue41984] Empty __slots__ can create untracked reference cycles

2020-10-14 Thread Brandt Bucher
Change by Brandt Bucher : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker ___ ___

[issue41984] Empty __slots__ can create untracked reference cycles

2020-10-14 Thread Brandt Bucher
Brandt Bucher added the comment: New changeset c13b847a6f913b72eeb71651ff626390b738d973 by Brandt Bucher in branch 'master': bpo-41984: GC track all user classes (GH-22701) https://github.com/python/cpython/commit/c13b847a6f913b72eeb71651ff626390b738d973 --

[issue41984] Empty __slots__ can create untracked reference cycles

2020-10-14 Thread miss-islington
Change by miss-islington : -- pull_requests: +21673 pull_request: https://github.com/python/cpython/pull/22703 ___ Python tracker ___ __

[issue41984] Empty __slots__ can create untracked reference cycles

2020-10-14 Thread miss-islington
Change by miss-islington : -- nosy: +miss-islington nosy_count: 4.0 -> 5.0 pull_requests: +21672 pull_request: https://github.com/python/cpython/pull/22702 ___ Python tracker _

[issue41984] Empty __slots__ can create untracked reference cycles

2020-10-14 Thread Brandt Bucher
Change by Brandt Bucher : -- keywords: +patch pull_requests: +21671 stage: -> patch review pull_request: https://github.com/python/cpython/pull/22701 ___ Python tracker ___ __

[issue41984] Empty __slots__ can create untracked reference cycles

2020-10-14 Thread Brandt Bucher
Brandt Bucher added the comment: Actually, never mind. Because of the way finalization works, we need to create untracked *types* for these tests, not untracked *instances*. PR up soon. -- ___ Python tracker _

[issue41984] Empty __slots__ can create untracked reference cycles

2020-10-14 Thread Brandt Bucher
Brandt Bucher added the comment: I'll hold off until https://bugs.python.org/issue42039 is resolved. -- ___ Python tracker ___ ___

[issue41984] Empty __slots__ can create untracked reference cycles

2020-10-14 Thread Pablo Galindo Salgado
Pablo Galindo Salgado added the comment: In any case, you can expose: https://docs.python.org/3/c-api/gcsupport.html#c.PyObject_GC_UnTrack in the testcapi module -- ___ Python tracker _

[issue41984] Empty __slots__ can create untracked reference cycles

2020-10-14 Thread Pablo Galindo Salgado
Pablo Galindo Salgado added the comment: > I'm not sure that's true... :) Oh boy, I need toehemyeah I will be back inone second... -- ___ Python tracker ___ _

[issue41984] Empty __slots__ can create untracked reference cycles

2020-10-14 Thread Brandt Bucher
Brandt Bucher added the comment: > there is gc.untrack() I'm not sure that's true... :) Although perhaps track()/untrack() functions *could* be useful to add to the gc module... but that's a separate conversation. -- ___ Python tracker

[issue41984] Empty __slots__ can create untracked reference cycles

2020-10-14 Thread Pablo Galindo Salgado
Pablo Galindo Salgado added the comment: > I think I can just create a simple utility in _testcapi to untrack instances > for this purpose. I have the feeling that I am misunderstanding what you refer to, but if is **untrack** what you need, there is gc.untrack() -- __

[issue41984] Empty __slots__ can create untracked reference cycles

2020-10-14 Thread Brandt Bucher
Brandt Bucher added the comment: No problem. I just need to rework some hacks in test_finalization where we use empty __slots__ to create non-GC types. I think I can just create a simple utility in _testcapi to untrack instances for this purpose. -- _

[issue41984] Empty __slots__ can create untracked reference cycles

2020-10-14 Thread Pablo Galindo Salgado
Pablo Galindo Salgado added the comment: Thanks a lot, Brandt for doing the benchmarking! I think that unpack_sequence is **very** affected by code locality. I was debugging it recently with Linux perf (https://perf.wiki.kernel.org/index.php/Main_Page) and it shows that is extremely affecte

[issue41984] Empty __slots__ can create untracked reference cycles

2020-10-14 Thread Brandt Bucher
Brandt Bucher added the comment: Using the following patch: https://github.com/python/cpython/compare/master...brandtbucher:track-all-heap-types I got the following pyperformance results (with PGO/LTO and CPU isolation, insignificant rows omitted): 2020-10-13_20-04-master-7992579cd27f.json.

[issue41984] Empty __slots__ can create untracked reference cycles

2020-10-09 Thread Pablo Galindo Salgado
Pablo Galindo Salgado added the comment: > I’m just not sure I see a way to fix this without tracking them all. IIRC we do skip the GC flags for user-created types only when the subtype is not adding new variables *and* the base class is not a GC class by itself. This includes the case with _

[issue41984] Empty __slots__ can create untracked reference cycles

2020-10-09 Thread Brandt Bucher
Brandt Bucher added the comment: > 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 re

[issue41984] Empty __slots__ can create untracked reference cycles

2020-10-09 Thread Pablo Galindo Salgado
Pablo Galindo Salgado added the comment: Thanks for noticing this, Brandt! > The fix is simple: track all instances of user-defined classes, no exceptions I have the fear that this may increase the time of collections substantially because even if many of them won't have references at all, t

[issue41984] Empty __slots__ can create untracked reference cycles

2020-10-09 Thread Brandt Bucher
New submission from Brandt Bucher : Currently, we don't track instances of certain heap types based on the assumption that "no members" == "no reference cycles". Unfortunately, it's still possible to create untracked reference cycles with one's parents. The following program leaks memory: whi