[tor-commits] [stem/master] Fix a problem with a mock object not recognized as a coroutine function
atagar at torproject.org
atagar at torproject.org
Thu Jul 16 01:28:59 UTC 2020
commit f90cb98741405f6a9d882238a89d9360665992c1
Author: Illia Volochii <illia.volochii at gmail.com>
Date: Sun Apr 26 21:48:35 2020 +0300
Fix a problem with a mock object not recognized as a coroutine function
---
stem/control.py | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/stem/control.py b/stem/control.py
index 3a687f1c..3eb706e0 100644
--- a/stem/control.py
+++ b/stem/control.py
@@ -3834,10 +3834,9 @@ class AsyncController(_ControllerClassMethodMixin, BaseController):
if listener_type == event_type:
for listener in event_listeners:
try:
- if asyncio.iscoroutinefunction(listener):
- await listener(event_message)
- else:
- listener(event_message)
+ potential_coroutine = listener(event_message)
+ if asyncio.iscoroutine(potential_coroutine):
+ await potential_coroutine
except Exception as exc:
log.warn('Event listener raised an uncaught exception (%s): %s' % (exc, event))
More information about the tor-commits
mailing list