Skip to content
Myr

Merge pull request #4488 from pallets/typing-context-exit

Before adoption: this commit came in with the history the project adopted, so no landing records it.

accurate type for `__exit__`

authored by David Lord · committed by GitHub · parents cb7cd1e, faaa559 · Browse files · 3 files+14 added−3 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

3 files+14 added−3 removed

  • other:+14 added−3 removed

3 files+14 added−3 removed

modified:src/flask/ctx.py+8 added-2 removed
265 unmodified lines
266 self.push()267 return self268269 def __exit__(270 self, exc_type: type, exc_value: BaseException, tb: TracebackType270 self,271 exc_type: t.Optional[type],272 exc_value: t.Optional[BaseException],273 tb: t.Optional[TracebackType],274 ) -> None:275 self.pop(exc_value)276277
215 unmodified lines
493 self.push()494 return self495496 def __exit__(494 self, exc_type: type, exc_value: BaseException, tb: TracebackType497 self,498 exc_type: t.Optional[type],499 exc_value: t.Optional[BaseException],500 tb: t.Optional[TracebackType],501 ) -> None:502 # do not pop the request stack if we are in debug mode and an503 # exception happened. This will allow the debugger to still504 # access the request object in the interactive shell. Furthermore
9 unmodified lines
modified:src/flask/testing.py+4 added-1 removed
225 unmodified lines
226 self.preserve_context = True227 return self228229 def __exit__(230 self, exc_type: type, exc_value: BaseException, tb: TracebackType230 self,231 exc_type: t.Optional[type],232 exc_value: t.Optional[BaseException],233 tb: t.Optional[TracebackType],234 ) -> None:235 self.preserve_context = False236237 # Normally the request context is preserved until the next
46 unmodified lines
modified:CHANGES.rst+2 added
48 unmodified lines
49 :issue:`4485`50- Relax typing for ``errorhandler`` to allow the user to use more51 precise types and decorate the same function multiple times.52 :issue:`4095, 4295, 4297`53- Fix typing for ``__exit__`` methods for better compatibility with54 ``ExitStack``. :issue:`4474`555657Version 2.0.358-------------
1199 unmodified lines