Fix type annotation for __exit__ methods
This commit is contained in:
parent
a960236117
commit
d541b04420
3 changed files with 13 additions and 3 deletions
|
|
@ -8,6 +8,7 @@ Unreleased
|
||||||
- Fix type annotation for ``teardown_request``. :issue:`4093`
|
- Fix type annotation for ``teardown_request``. :issue:`4093`
|
||||||
- Fix type annotation for ``before_request`` and ``before_app_request``
|
- Fix type annotation for ``before_request`` and ``before_app_request``
|
||||||
decorators. :issue:`4104`
|
decorators. :issue:`4104`
|
||||||
|
- Fix type annotation for ``__exit__`` methods. :pr:`4108`
|
||||||
|
|
||||||
|
|
||||||
Version 2.0.1
|
Version 2.0.1
|
||||||
|
|
|
||||||
|
|
@ -258,7 +258,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[t.Type[BaseException]],
|
||||||
|
exc_value: t.Optional[BaseException],
|
||||||
|
tb: t.Optional[TracebackType],
|
||||||
) -> None:
|
) -> None:
|
||||||
self.pop(exc_value)
|
self.pop(exc_value)
|
||||||
|
|
||||||
|
|
@ -464,7 +467,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[t.Type[BaseException]],
|
||||||
|
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[t.Type[BaseException]],
|
||||||
|
exc_value: t.Optional[BaseException],
|
||||||
|
tb: t.Optional[TracebackType],
|
||||||
) -> None:
|
) -> None:
|
||||||
self.preserve_context = False
|
self.preserve_context = False
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue