def set_history_length(length):
    """Set the maximal number of items which will be written to
    the history file. A negative length is used to inhibit
    history truncation.
    """
    global _history_length
    _history_length = length
