numpy.testing.assert_no_gc_cycles

testing.assert_no_gc_cycles(*args, **kwargs)[source]

Fail if the given callable produces any reference cycles.

If called with all arguments omitted, may be used as a context manager:

with assert_no_gc_cycles():
    do_something()

New in version 1.15.0.

Parameters:
funccallable

The callable to test.

*argsArguments

Arguments passed to func.

**kwargsKwargs

Keyword arguments passed to func.

Returns:
Nothing. The result is deliberately discarded to ensure that all cycles
are found.

© 2005–2024 NumPy Developers
Licensed under the 3-clause BSD License.
https://numpy.org/doc/2.0/reference/generated/numpy.testing.assert_no_gc_cycles.html