Visitar URL original
gh-135552: Add tests that check if weakref for tp_subclasses cleared after finalization by sergey-miryanov · Pull Request #136304 · python/cpython · GitHub
Skip to content
Merged
Changes from 1 commit
Commits
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
Next Next commit
Add tests
  • Loading branch information
fxeqxmulfx authored and sergey-miryanov committed Jul 4, 2025
commit 4d648b48aaabb1bf0cf76414d1ac629cadaf7534
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