Clear exceptions when pushing a context

Fixes #882
This commit is contained in:
Daniel Neuhäuser 2013-10-16 20:12:20 +02:00
parent 94f4360137
commit a3a2f521f1
4 changed files with 40 additions and 0 deletions

View file

@ -163,6 +163,8 @@ class AppContext(object):
def push(self):
"""Binds the app context to the current context."""
self._refcnt += 1
if hasattr(sys, 'exc_clear'):
sys.exc_clear()
_app_ctx_stack.push(self)
appcontext_pushed.send(self.app)
@ -312,6 +314,9 @@ class RequestContext(object):
else:
self._implicit_app_ctx_stack.append(None)
if hasattr(sys, 'exc_clear'):
sys.exc_clear()
_request_ctx_stack.push(self)
# Open the session at the moment that the request context is