Added a workaround for a pypy bug in context managers

This commit is contained in:
Armin Ronacher 2014-01-26 17:34:37 +00:00
parent de7e2bcf7a
commit 6ec83e18dc
2 changed files with 31 additions and 0 deletions

View file

@ -19,6 +19,7 @@ from werkzeug.exceptions import HTTPException
from .globals import _request_ctx_stack, _app_ctx_stack
from .module import blueprint_is_module
from .signals import appcontext_pushed, appcontext_popped
from ._compat import BROKEN_PYPY_CTXMGR_EXIT
class _AppCtxGlobals(object):
@ -187,6 +188,9 @@ class AppContext(object):
def __exit__(self, exc_type, exc_value, tb):
self.pop(exc_value)
if BROKEN_PYPY_CTXMGR_EXIT and exc_type is not None:
raise exc_type, exc_value, tb
class RequestContext(object):
"""The request context contains all request relevant information. It is
@ -390,6 +394,9 @@ class RequestContext(object):
# See flask.testing for how this works.
self.auto_pop(exc_value)
if BROKEN_PYPY_CTXMGR_EXIT and exc_type is not None:
raise exc_type, exc_value, tb
def __repr__(self):
return '<%s \'%s\' [%s] of %s>' % (
self.__class__.__name__,