Merge pull request #1813 from Kodiologist/homeless

Avoid a crash when we can't access a history file
This commit is contained in:
Ryan Gonzalez 2019-08-19 12:40:08 -05:00 committed by GitHub
commit 1b8b1f110a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 2 deletions

View File

@ -27,6 +27,7 @@ Bug Fixes
* Statements in the second argument of `assert` are now executed. * Statements in the second argument of `assert` are now executed.
* Fixed the expression of a while loop that contains statements being compiled twice. * Fixed the expression of a while loop that contains statements being compiled twice.
* `hy2py` can now handle format strings. * `hy2py` can now handle format strings.
* Fixed crashes from inaccessible history files.
0.17.0 0.17.0
============================== ==============================

View File

@ -123,7 +123,7 @@ def completion(completer=None):
try: try:
readline.read_history_file(history) readline.read_history_file(history)
except IOError: except IOError:
open(history, 'a').close() pass
readline.parse_and_bind(readline_bind) readline.parse_and_bind(readline_bind)
@ -131,4 +131,7 @@ def completion(completer=None):
yield yield
finally: finally:
if docomplete: if docomplete:
readline.write_history_file(history) try:
readline.write_history_file(history)
except IOError:
pass