mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
Issue #18214: Improve finalization of Python modules to avoid setting their globals to None, in most cases.
This commit is contained in:
parent
c27cd71cd7
commit
dcedaf6e53
9 changed files with 178 additions and 109 deletions
|
@ -29,6 +29,7 @@ Notes:
|
|||
|
||||
"""
|
||||
|
||||
import atexit
|
||||
import builtins
|
||||
import __main__
|
||||
|
||||
|
@ -158,3 +159,8 @@ except ImportError:
|
|||
pass
|
||||
else:
|
||||
readline.set_completer(Completer().complete)
|
||||
# Release references early at shutdown (the readline module's
|
||||
# contents are quasi-immortal, and the completer function holds a
|
||||
# reference to globals).
|
||||
atexit.register(lambda: readline.set_completer(None))
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue