File tree Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -418,7 +418,16 @@ def register_readline():
418
418
readline .read_history_file (history )
419
419
except IOError :
420
420
pass
421
- atexit .register (readline .write_history_file , history )
421
+
422
+ def write_history ():
423
+ try :
424
+ readline .write_history_file (history )
425
+ except (FileNotFoundError , PermissionError ):
426
+ # home directory does not exist or is not writable
427
+ # https://bugs.python.org/issue19891
428
+ pass
429
+
430
+ atexit .register (write_history )
422
431
423
432
sys .__interactivehook__ = register_readline
424
433
Original file line number Diff line number Diff line change
1
+ Ignore errors caused by missing / non-writable homedir while writing history
2
+ during exit of an interactive session. Patch by Anthony Sottile.
You can’t perform that action at this time.
0 commit comments