You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Within the app.app_context() context (managed by with) an exception is raised and handled. However, the teardown_appcontext() handler is still passed the exception value.
That's because the exception was raised and handled within the same frame, and thus sys.exc_info() is still available. The AppContext.__exit__() method did pass in None for the exception value:
Consider the following:
Within the
app.app_context()
context (managed bywith
) an exception is raised and handled. However, theteardown_appcontext()
handler is still passed the exception value.That's because the exception was raised and handled within the same frame, and thus
sys.exc_info()
is still available. TheAppContext.__exit__()
method did pass inNone
for the exception value:but the
AppContext.pop()
method cannot distinguish this from not passing in a value at all:This can easily be remedied by using a different sentinel default value:
The text was updated successfully, but these errors were encountered: