mirror of https://github.com/pallets/flask.git
accurate type for __exit__
This commit is contained in:
parent
cb7cd1e79b
commit
faaa5594b2
|
@ -50,6 +50,8 @@ Unreleased
|
||||||
- Relax typing for ``errorhandler`` to allow the user to use more
|
- Relax typing for ``errorhandler`` to allow the user to use more
|
||||||
precise types and decorate the same function multiple times.
|
precise types and decorate the same function multiple times.
|
||||||
:issue:`4095, 4295, 4297`
|
:issue:`4095, 4295, 4297`
|
||||||
|
- Fix typing for ``__exit__`` methods for better compatibility with
|
||||||
|
``ExitStack``. :issue:`4474`
|
||||||
|
|
||||||
|
|
||||||
Version 2.0.3
|
Version 2.0.3
|
||||||
|
|
|
@ -267,7 +267,10 @@ class AppContext:
|
||||||
return self
|
return self
|
||||||
|
|
||||||
def __exit__(
|
def __exit__(
|
||||||
self, exc_type: type, exc_value: BaseException, tb: TracebackType
|
self,
|
||||||
|
exc_type: t.Optional[type],
|
||||||
|
exc_value: t.Optional[BaseException],
|
||||||
|
tb: t.Optional[TracebackType],
|
||||||
) -> None:
|
) -> None:
|
||||||
self.pop(exc_value)
|
self.pop(exc_value)
|
||||||
|
|
||||||
|
@ -491,7 +494,10 @@ class RequestContext:
|
||||||
return self
|
return self
|
||||||
|
|
||||||
def __exit__(
|
def __exit__(
|
||||||
self, exc_type: type, exc_value: BaseException, tb: TracebackType
|
self,
|
||||||
|
exc_type: t.Optional[type],
|
||||||
|
exc_value: t.Optional[BaseException],
|
||||||
|
tb: t.Optional[TracebackType],
|
||||||
) -> None:
|
) -> None:
|
||||||
# do not pop the request stack if we are in debug mode and an
|
# do not pop the request stack if we are in debug mode and an
|
||||||
# exception happened. This will allow the debugger to still
|
# exception happened. This will allow the debugger to still
|
||||||
|
|
|
@ -227,7 +227,10 @@ class FlaskClient(Client):
|
||||||
return self
|
return self
|
||||||
|
|
||||||
def __exit__(
|
def __exit__(
|
||||||
self, exc_type: type, exc_value: BaseException, tb: TracebackType
|
self,
|
||||||
|
exc_type: t.Optional[type],
|
||||||
|
exc_value: t.Optional[BaseException],
|
||||||
|
tb: t.Optional[TracebackType],
|
||||||
) -> None:
|
) -> None:
|
||||||
self.preserve_context = False
|
self.preserve_context = False
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue