Module Expr Str Import alias Import alias ImportFrom alias Assign NameStore ListLoad Str Str Str ClassDef bases NameLoad body Pass decorator_list FunctionDef arguments args NameParam defaults body Expr Str If CompareEq Call AttributeLoad NameLoad attr NameLoad body Return If NameLoad body Expr Call AttributeLoad NameLoad attr orelse Expr Call AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore Call AttributeLoad NameLoad attr Expr Call NameLoad NameLoad Expr Yield Expr Call NameLoad NameLoad decorator_list NameLoad FunctionDef arguments args NameParam defaults vararg kwarg body Expr Str With Call NameLoad NameLoad body Assign NameStore Call NameLoad NameLoad NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad Expr Yield NameLoad Delete NameDel If CompareIsNot Call NameLoad NameLoad body Raise Call NameLoad Str decorator_list NameLoad
N/A N/A 
Module for testing automatic garbage collection of objects

.. autosummary::
   :toctree: generated/

   set_gc_state - enable or disable garbage collection
   gc_state - context manager for given state of garbage collector
   assert_deallocated - context manager to check for circular references on object

 N/A weakref N/A gc contextlib contextmanager N/A __all__ N/A set_gc_state gc_state assert_deallocated ReferenceError N/A AssertionError N/A N/A N/A set_gc_state N/A N/A state N/A N/A N/A  Set status of garbage collector  N/A N/A N/A N/A gc isenabled state N/A N/A N/A state N/A N/A N/A N/A gc enable N/A N/A N/A N/A gc disable N/A gc_state N/A N/A state N/A N/A N/A  Context manager to set state of garbage collector to `state`

    Parameters
    ----------
    state : bool
        True for gc enabled, False for disabled

    Examples
    --------
    >>> with gc_state(False):
    ...     assert not gc.isenabled()
    >>> with gc_state(True):
    ...     assert gc.isenabled()
     N/A orig_state N/A N/A gc isenabled N/A N/A set_gc_state state N/A N/A N/A N/A set_gc_state orig_state N/A contextmanager assert_deallocated N/A N/A func N/A args kwargs N/A N/A Context manager to check that object is deallocated

    This is useful for checking that an object can be freed directly by
    reference counting, without requiring gc to break reference cycles.
    GC is disabled inside the context manager.

    Parameters
    ----------
    func : callable
        Callable to create object to check
    \*args : sequence
        positional arguments to `func` in order to create object to check
    \*\*kwargs : dict
        keyword arguments to `func` in order to create object to check

    Examples
    --------
    >>> class C(object): pass
    >>> with assert_deallocated(C) as c:
    ...     # do something
    ...     del c

    >>> class C(object):
    ...     def __init__(self):
    ...         self._circular = self # Make circular reference
    >>> with assert_deallocated(C) as c: #doctest: +IGNORE_EXCEPTION_DETAIL
    ...     # do something
    ...     del c
    Traceback (most recent call last):
        ...
    ReferenceError: Remaining reference(s) to object
     N/A N/A gc_state False N/A N/A obj N/A func args kwargs N/A ref N/A N/A weakref ref obj N/A N/A obj N/A obj N/A N/A N/A ref None N/A N/A N/A ReferenceError Remaining reference(s) to object N/A contextmanager