Add internal routine _PyModule_Clear(), which does approximately what · pythoncapi/cpython@f1dc061 · GitHub
Skip to content

Commit f1dc061

Browse files
committed
Add internal routine _PyModule_Clear(), which does approximately what
clear_carefully() used to do in import.c. Differences: leave only __builtins__ alone in the 2nd pass; and don't clear the dictionary (on the theory that as long as there are references left to the dictionary, those might be destructors that might expect __builtins__ to be alive when they run; and __builtins__ can't normally be part of a cycle).
1 parent c83db33 commit f1dc061

2 files changed

Lines changed: 51 additions & 1 deletion

File tree

Include/moduleobject.h

Lines changed: 1 addition & 0 deletions

Objects/moduleobject.c

Lines changed: 50 additions & 1 deletion

0 commit comments

Comments
 (0)