Issue #5845: In site.py, only load readline history from ~/.python_history if no history has been read already. This avoids double writes to the history file at shutdown.
This commit is contained in:
parent
95536b8405
commit
5d23e6d543
19
Lib/site.py
19
Lib/site.py
|
@ -405,12 +405,19 @@ def enablerlcompleter():
|
||||||
# want to ignore the exception.
|
# want to ignore the exception.
|
||||||
pass
|
pass
|
||||||
|
|
||||||
history = os.path.join(os.path.expanduser('~'), '.python_history')
|
if readline.get_history_item(1) is None:
|
||||||
try:
|
# If no history was loaded, default to .python_history.
|
||||||
readline.read_history_file(history)
|
# The guard is necessary to avoid doubling history size at
|
||||||
except IOError:
|
# each interpreter exit when readline was already configured
|
||||||
pass
|
# through a PYTHONSTARTUP hook, see:
|
||||||
atexit.register(readline.write_history_file, history)
|
# http://bugs.python.org/issue5845#msg198636
|
||||||
|
history = os.path.join(os.path.expanduser('~'),
|
||||||
|
'.python_history')
|
||||||
|
try:
|
||||||
|
readline.read_history_file(history)
|
||||||
|
except IOError:
|
||||||
|
pass
|
||||||
|
atexit.register(readline.write_history_file, history)
|
||||||
|
|
||||||
sys.__interactivehook__ = register_readline
|
sys.__interactivehook__ = register_readline
|
||||||
|
|
||||||
|
|
|
@ -15,6 +15,10 @@ Core and Builtins
|
||||||
Library
|
Library
|
||||||
-------
|
-------
|
||||||
|
|
||||||
|
- Issue #5845: In site.py, only load readline history from ~/.python_history
|
||||||
|
if no history has been read already. This avoids double writes to the
|
||||||
|
history file at shutdown.
|
||||||
|
|
||||||
- Properly initialize all fields of a SSL object after allocation.
|
- Properly initialize all fields of a SSL object after allocation.
|
||||||
|
|
||||||
- Issue #19095: SSLSocket.getpeercert() now raises ValueError when the
|
- Issue #19095: SSLSocket.getpeercert() now raises ValueError when the
|
||||||
|
|
Loading…
Reference in New Issue