[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [stem/master] Fix a problem with a mock object not recognized as a coroutine function
commit f90cb98741405f6a9d882238a89d9360665992c1
Author: Illia Volochii <illia.volochii@xxxxxxxxx>
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))
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits