diff --git a/NEWS.rst b/NEWS.rst index 6e5c8ff..f11c5c8 100644 --- a/NEWS.rst +++ b/NEWS.rst @@ -27,6 +27,7 @@ Bug Fixes * Statements in the second argument of `assert` are now executed. * Fixed the expression of a while loop that contains statements being compiled twice. * `hy2py` can now handle format strings. +* Fixed crashes from inaccessible history files. 0.17.0 ============================== diff --git a/hy/completer.py b/hy/completer.py index b1969c1..34308ba 100644 --- a/hy/completer.py +++ b/hy/completer.py @@ -123,7 +123,7 @@ def completion(completer=None): try: readline.read_history_file(history) except IOError: - open(history, 'a').close() + pass readline.parse_and_bind(readline_bind) @@ -131,4 +131,7 @@ def completion(completer=None): yield finally: if docomplete: - readline.write_history_file(history) + try: + readline.write_history_file(history) + except IOError: + pass