def _cleanup(request):

    del request._in_do
    del request._chunked
    del request._charset
    del request._unhandled

    del request._context

    try:
        del request._gen
    except AttributeError:
        del request._callbacks
        del request._waiting
        return

    # Cleanup any timers.
    for item in request._waiting:
        timer = getattr(item, "timeout", None)
        if timer and callable(timer):
            try:
                timer()
            except Exception:
                # Who knows what could happen here.
                pass

    # Asynchronous Internals
    request._callbacks.clear()
    del request._callbacks
    del request._waiting
Delete the context manager and everything else.
dataset/ETHPy150Open ecdavis/pants/pants/web/asynchronous.py/_cleanup