import atexit
atexit.register(savehist)
- def unset_history():
- import atexit
- atexit._exithandlers = []
- builtins.unset_history = unset_history
+ if hasattr(atexit, '_exithandlers'):
+ def unset_history2():
+ import atexit
+ atexit._exithandlers = []
+ builtins.unset_history = unset_history2
+ elif hasattr(atexit, '_clear') and callable(atexit._clear):
+ def unset_history3():
+ import atexit
+ atexit._clear()
+ builtins.unset_history = unset_history3
+ else:
+ sys.stderr.write('Error: cannot clear exit handlers\n')
except (ImportError, AttributeError):
# no readline or atexit, or readline doesn't have