'Binds the request context to the current context.'

def push(self):

    top = _request_ctx_stack.top
    if ((top is not None) and top.preserved):
        top.pop(top._preserved_exc)
    app_ctx = _app_ctx_stack.top
    if ((app_ctx is None) or (app_ctx.app != self.app)):
        app_ctx = self.app.app_context()
        app_ctx.push()
        self._implicit_app_ctx_stack.append(app_ctx)
    else:
        self._implicit_app_ctx_stack.append(None)
    if hasattr(sys, 'exc_clear'):
        sys.exc_clear()
    _request_ctx_stack.push(self)
    if (self.session is None):
        session_interface = self.app.session_interface
        self.session = session_interface.open_session(self.app, self.request)
        if (self.session is None):
            self.session = session_interface.make_null_session(self.app)
