diff options
author | Yury Selivanov <yselivanov@sprymix.com> | 2016-02-04 19:08:23 (GMT) |
---|---|---|
committer | Yury Selivanov <yselivanov@sprymix.com> | 2016-02-04 19:08:23 (GMT) |
commit | ab8d4fba6d0657420b53b2988cf3810c3f2ace67 (patch) | |
tree | 40614615f88383812e3b75a6f0265688bed872fd /Lib/rlcompleter.py | |
parent | f50215412cdc41b7845a6c0bb040a8f3521a0b84 (diff) | |
parent | 46f7785e28c17f33252a95a57dd3827811291394 (diff) | |
download | cpython-ab8d4fba6d0657420b53b2988cf3810c3f2ace67.zip cpython-ab8d4fba6d0657420b53b2988cf3810c3f2ace67.tar.gz cpython-ab8d4fba6d0657420b53b2988cf3810c3f2ace67.tar.bz2 |
Merge 3.5
Diffstat (limited to 'Lib/rlcompleter.py')
-rw-r--r-- | Lib/rlcompleter.py | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/Lib/rlcompleter.py b/Lib/rlcompleter.py index 931edcc..bca4a7b 100644 --- a/Lib/rlcompleter.py +++ b/Lib/rlcompleter.py @@ -75,9 +75,12 @@ class Completer: if not text.strip(): if state == 0: - readline.insert_text('\t') - readline.redisplay() - return '' + if _readline_available: + readline.insert_text('\t') + readline.redisplay() + return '' + else: + return '\t' else: return None @@ -192,10 +195,11 @@ def get_class_members(klass): try: import readline except ImportError: - pass + _readline_available = False 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)) + _readline_available = True |