Ticket #10855: trac_10855_ensure_that_reset_forgets.patch

File trac_10855_ensure_that_reset_forgets.patch, 1.4 KB (added by dsm, 12 years ago)
  • sage/misc/reset.pyx

    # HG changeset patch
    # User D. S. McNeil
    # Date 1298744397 -28800
    # Node ID 4e8d3c913eb7f096a5164408ea7a0d45eef12900
    # Parent  8438b7c20d79c02a2ece3e1c3f7224a772ff8f07
    Trac 10855: ensure that reset forgets
    
    diff -r 8438b7c20d79 -r 4e8d3c913eb7 sage/misc/reset.pyx
    a b  
    66
    77def reset(vars=None):
    88    """
    9     Delete all user defined variables, reset all globals variables
    10     back to their default state, and reset all interfaces to other
     9    Delete all user-defined variables, reset all global variables
     10    back to their default states, and reset all interfaces to other
    1111    computer algebra systems.
    1212
    1313    If vars is specified, just restore the value of vars and leave
     
    2525        sage: reset()
    2626        sage: x
    2727        x
     28
     29    TESTS:
     30
     31    Confirm that assumptions don't survive a reset (trac #10855)::
     32
     33        sage: assume(x > 3)
     34        sage: assumptions()
     35        [x > 3]
     36        sage: bool(x > 3)
     37        True
     38        sage: reset()
     39        sage: assumptions()
     40        []
     41        sage: bool(x > 3)
     42        False
     43       
    2844    """
     45    from sage.symbolic.assumptions import forget
    2946    if not vars is None:
    3047        restore(vars)
    3148        return
     
    3855            except KeyError:
    3956                pass
    4057    restore()
     58    forget()
    4159    reset_interfaces()
    4260    reset_attached()
    4361