diff --git a/_pytest/python.py b/_pytest/python.py index 4ef5e9849..5c063b041 100644 --- a/_pytest/python.py +++ b/_pytest/python.py @@ -938,6 +938,12 @@ def raises(ExpectedException, *args, **kwargs): This helper produces a ``py.code.ExceptionInfo()`` object. + Note that any local references made to such returned + ``py.code.ExceptionInfo()`` objects should be explicitly cleared, as they + are part of a reference cycle similar to local references to caught Python + exception objects. See the official Python ``try`` statement documentation + for more detailed information. + If using Python 2.5 or above, you may use this function as a context manager::