8000 gh-135552: Skip clearing of tp_subclasses weakrefs in GC by sergey-miryanov · Pull Request #136147 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-135552: Skip clearing of tp_subclasses weakrefs in GC #136147

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

Closed
Closed
Changes from 1 commit
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
f14f0ba
Reset type cache after finalization
sergey-miryanov Jun 19, 2025
61fc657
Add tests
fxeqxmulfx Jun 22, 2025
d8124a9
Organize tests
sergey-miryanov Jun 22, 2025
bb21510
Remove wrong solution
sergey-miryanov Jun 22, 2025
0e649ab
Do not clear weakrefs to types before finalization of instances
sergey-miryanov Jun 22, 2025
ff79617
Merge branch 'main' into gh-135552-fix-gc-segfault
sergey-miryanov Jun 22, 2025
ac394bc
Add news
sergey-miryanov Jun 22, 2025
3b18738
Update Misc/NEWS.d/next/Core_and_Builtins/2025-06-23-01-07-09.gh-issu…
sergey-miryanov Jun 23, 2025
de8841c
Update Misc/NEWS.d/next/Core_and_Builtins/2025-06-23-01-07-09.gh-issu…
sergey-miryanov Jun 23, 2025
f8745e0
Split unreachable to types and objects while deduce
sergey-miryanov Jun 23, 2025
f166933
Merge branch 'gh-135552-fix-gc-segfault' of github.com:sergey-miryano…
sergey-miryanov Jun 23, 2025
3fe0f15
Simplify tests
sergey-miryanov Jun 24, 2025
96f09db
Merge branch 'main' into gh-135552-fix-gc-segfault-2
sergey-miryanov Jun 30, 2025
1ad18ec
Remove unreachable_types pass
sergey-miryanov Jun 30, 2025
bc0297c
Remove obsolete comments
sergey-miryanov Jun 30, 2025
3294f2e
Add is_subclass to PyWeakReference and do not clear those weakrefs in GC
sergey-miryanov Jun 30, 2025
6c45159
Create weakrefs for subclasses with sentinel callback to properly han…
sergey-miryanov Jul 1, 2025
e5e95ff
Update news entry
sergey-miryanov Jul 1, 2025
edf634c
Add some comments
sergey-miryanov Jul 1, 2025
bd7d9f3
Crazy idea to use noop-callback as a sentinel
sergey-miryanov Jul 2, 2025
987f6a3
Immortalize sentinel callback
sergey-miryanov Jul 2, 2025
be87675
Clear weakref sentinel in the right place
sergey-miryanov Jul 2, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add tests
  • Loading branch information
fxeqxmulfx authored Jun 22, 2025
commit 61fc657b0833d19befe51d54e73c2f2831fa9e11
17 changes: 17 additions & 0 deletions Lib/test/test_gc.py
Original file line number Diff line number Diff line change
Expand Up @@ -1517,6 +1517,23 @@ def test_ast_fini(self):
""")
assert_python_ok("-c", code)

def test_reset_type_cache_after_finalization(self):
# https://github.com/python/cpython/issues/135552
code = textwrap.dedent("""
class BaseNode:
def __del__(self):
BaseNode.next = BaseNode.next.next


class Node(BaseNode):
pass


BaseNode.next = Node()
BaseNode.next.next = Node()
""")
assert_python_ok("-c", code)


def setUpModule():
global enabled, debug
Expand Down
Loading
0