8000 gh-93353: Add test.support.late_deletion() by vstinner · Pull Request #93774 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-93353: Add test.support.late_deletion() #93774

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

Merged
merged 3 commits into from
Jun 13, 2022
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
Prev Previous commit
Next Next commit
Rephrase the documentation
  • Loading branch information
vstinner committed Jun 13, 2022
commit 84eb078604fecda942a74482f83960bcb9c45f78
7 changes: 4 additions & 3 deletions Lib/test/support/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2229,21 +2229,22 @@ def late_deletion(obj):

# Late CPython finalization:
# - finalize_interp_clear()
# - _PyInterpreterState_Clear()
# - _PyInterpreterState_Clear(): Clear PyInterpreterState members
# (ex: codec_search_path, before_forkers)
# - clear os.register_at_fork() callbacks
# - clear codecs.register() callbacks

ref_cycle = [obj]
ref_cycle.append(ref_cycle)

# PyInterpreterState.codec_search_path
# Store a reference in PyInterpreterState.codec_search_path
import codecs
def search_func(encoding):
return None
search_func.reference = ref_cycle
codecs.register(search_func)

# PyInterpreterState.before_forkers
# Store a reference in PyInterpreterState.before_forkers
def atfork_func():
pass
atfork_func.reference = ref_cycle
Expand Down
0