diff options
Diffstat (limited to 'Lib/rlcompleter.py')
-rw-r--r-- | Lib/rlcompleter.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/Lib/rlcompleter.py b/Lib/rlcompleter.py index 3f970536dd..94f9341bee 100644 --- a/Lib/rlcompleter.py +++ b/Lib/rlcompleter.py @@ -29,6 +29,7 @@ Notes: """ +import atexit import builtins import __main__ @@ -158,3 +159,7 @@ 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)) |