Fix stacktraces when using ObservableDeferred and async/await (#6836)

This commit is contained in:
Erik Johnston 2020-02-03 17:10:54 +00:00 committed by GitHub
parent 370080531e
commit ae5b3104f0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 0 deletions

1
changelog.d/6836.misc Normal file
View File

@ -0,0 +1 @@
Fix stacktraces when using `ObservableDeferred` and async/await.

View File

@ -73,6 +73,10 @@ class ObservableDeferred(object):
def errback(f):
object.__setattr__(self, "_result", (False, f))
while self._observers:
# This is a little bit of magic to correctly propagate stack
# traces when we `await` on one of the observer deferreds.
f.value.__failure__ = f
try:
# TODO: Handle errors here.
self._observers.pop().errback(f)