forked from orbit-oss/flask
Added a workaround for a pypy bug in context managers
This commit is contained in:
parent
de7e2bcf7a
commit
6ec83e18dc
2 changed files with 31 additions and 0 deletions
|
|
@ -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__,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue