Sync python with master branch
This commit is contained in:
parent
6590626a7a
commit
661576726d
1 changed files with 15 additions and 14 deletions
|
@ -1,16 +1,16 @@
|
||||||
"""Enable default readline configuration on interactive prompts, by
|
# Improve interactive prompts by configuring readline. This is done by
|
||||||
registering a sys.__interactivehook__.
|
# registering a custom hook as sys.__interactivehook__.
|
||||||
|
#
|
||||||
If the readline module can be imported, the hook will set the Tab key as
|
# If the readline module can be imported, the hook will:
|
||||||
completion key and register a history file, using
|
# 1. Set the Tab key as completion key.
|
||||||
$XDG_CACHE_HOME/python/history if XDG_CACHE_HOME iset and .python_history
|
# 2. Initialize readline (e.g. from .inputrc).
|
||||||
otherwise.
|
# 3. Register a history file, using:
|
||||||
"""
|
# - $XDG_CACHE_HOME/python/history if XDG_CACHE_HOME iset
|
||||||
import os
|
# - .python_history otherwise.
|
||||||
import sys
|
def configure_readline():
|
||||||
|
|
||||||
def register_readline():
|
|
||||||
import atexit
|
import atexit
|
||||||
|
import os
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import readline
|
import readline
|
||||||
import rlcompleter
|
import rlcompleter
|
||||||
|
@ -64,5 +64,6 @@ def register_readline():
|
||||||
|
|
||||||
atexit.register(write_history)
|
atexit.register(write_history)
|
||||||
|
|
||||||
sys.__interactivehook__ = register_readline
|
import sys
|
||||||
|
sys.__interactivehook__ = configure_readline
|
||||||
|
del sys, configure_readline # we don't want any of this in globals()
|
||||||
|
|
Loading…
Add table
Reference in a new issue