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 @@ -439,7 +439,16 @@ def register_readline():
439
439
readline .read_history_file (history )
440
440
except OSError :
441
441
pass
442
- atexit .register (readline .write_history_file , history )
442
+
443
+ def write_history ():
444
+ try :
445
+ readline .write_history_file (history )
446
+ except (FileNotFoundError , PermissionError ):
447
+ # home directory does not exist or is not writable
448
+ # https://bugs.python.org/issue19891
449
+ pass
450
+
451
+ atexit .register (write_history )
443
452
444
453
sys .__interactivehook__ = register_readline
445
454
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