Skip to content
Myr

fix typing that wasn't available in Python 3.6.0

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

authored by David Lord · committed by David Lord · parent 6fe7f45 · Browse files · 4 files+7 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

4 files+7 added−3 removed

  • other:+7 added−3 removed

4 files+7 added−3 removed

modified:src/flask/app.py+2 added-1 removed
70 unmodified lines
71from .wrappers import Request72from .wrappers import Response7374if t.TYPE_CHECKING:75 import typing_extensions as te76 from .blueprints import Blueprint77 from .testing import FlaskClient78 from .testing import FlaskCliRunner79
1361 unmodified lines
1441 self.logger.error(1442 f"Exception on {request.path} [{request.method}]", exc_info=exc_info1443 )14441444 def raise_routing_exception(self, request: Request) -> t.NoReturn:1445 def raise_routing_exception(self, request: Request) -> "te.NoReturn":1446 """Exceptions that are recording during routing are reraised with1447 this method. During debug we are not reraising redirect requests1448 for non ``GET``, ``HEAD``, or ``OPTIONS`` requests and we're raising1449 a different error instead to help debug situations.
627 unmodified lines
modified:src/flask/sessions.py+2 added-1 removed
10 unmodified lines
11from .helpers import is_ip12from .json.tag import TaggedJSONSerializer1314if t.TYPE_CHECKING:15 import typing_extensions as te16 from .app import Flask17 from .wrappers import Request, Response1819
72 unmodified lines
92 available. Will still allow read-only access to the empty session93 but fail on setting.94 """9595 def _fail(self, *args: t.Any, **kwargs: t.Any) -> t.NoReturn:96 def _fail(self, *args: t.Any, **kwargs: t.Any) -> "te.NoReturn":97 raise RuntimeError(98 "The session is unavailable because no secret "99 "key was set. Set the secret_key on the "100 "application to something unique and secret."
304 unmodified lines
modified:src/flask/wrappers.py+2 added-1 removed
6 unmodified lines
7from . import json8from .globals import current_app910if t.TYPE_CHECKING:11 import typing_extensions as te12 from werkzeug.routing import Rule131415class Request(RequestBase):
75 unmodified lines
91 from .debughelpers import attach_enctype_error_multidict9293 attach_enctype_error_multidict(self)9494 def on_json_loading_failed(self, e: Exception) -> t.NoReturn:95 def on_json_loading_failed(self, e: Exception) -> "te.NoReturn":96 if current_app and current_app.debug:97 raise BadRequest(f"Failed to decode JSON object: {e}")9899 raise BadRequest()
36 unmodified lines
modified:CHANGES.rst+1 added
10 unmodified lines
11- Mark top-level names as exported so type checking understands12 imports in user projects. :issue:`4024`13- Fix type annotation for ``g`` and inform mypy that it is a namespace14 object that has arbitrary attributes. :issue:`4020`15- Fix some types that weren't available in Python 3.6.0. :issue:`4040`161718Version 2.0.019-------------
1096 unmodified lines