Skip to content

Commit cfe6527

Browse files
committed
Fix async generators finalization to work correctly in debug mode
Closes #200.
1 parent 42df50d commit cfe6527

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

uvloop/loop.pyx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2966,10 +2966,7 @@ cdef class Loop:
29662966
def _asyncgen_finalizer_hook(self, agen):
29672967
self._asyncgens.discard(agen)
29682968
if not self.is_closed():
2969-
self.create_task(agen.aclose())
2970-
# Wake up the loop if the finalizer was called from
2971-
# a different thread.
2972-
self.handler_async.send()
2969+
self.call_soon_threadsafe(self.create_task, agen.aclose())
29732970

29742971
def _asyncgen_firstiter_hook(self, agen):
29752972
if self._asyncgens_shutdown_called:

0 commit comments

Comments
 (0)