File tree Expand file tree Collapse file tree 3 files changed +26
-2
lines changed Expand file tree Collapse file tree 3 files changed +26
-2
lines changed Original file line number Diff line number Diff line change @@ -244,7 +244,9 @@ def sync_send():
244
244
return responses
245
245
246
246
else :
247
- sync_send = list
247
+
248
+ async def sync_send ():
249
+ return []
248
250
249
251
responses , async_responses = await asyncio .gather (
250
252
sync_send (),
@@ -380,7 +382,9 @@ def sync_send():
380
382
return responses
381
383
382
384
else :
383
- sync_send = list
385
+
386
+ async def sync_send ():
387
+ return []
384
388
385
389
async def asend_and_wrap_exception (receiver ):
386
390
try :
Original file line number Diff line number Diff line change @@ -11,3 +11,7 @@ Bugfixes
11
11
12
12
* Fixed a regression in Django 5.0.2 where ``intcomma`` template filter could
13
13
return a leading comma for string representation of floats (:ticket:`35172`).
14
+
15
+ * Fixed a bug in Django 5.0 that caused a crash of ``Signal.asend()`` and
16
+ ``asend_robust()`` when all receivers were asynchronous functions
17
+ (:ticket:`35174`).
Original file line number Diff line number Diff line change @@ -626,3 +626,19 @@ async def failing_async_handler(**kwargs):
626
626
(async_handler , 1 ),
627
627
],
628
628
)
629
+
630
+ async def test_asend_only_async_receivers (self ):
631
+ async_handler = AsyncHandler ()
632
+ signal = dispatch .Signal ()
633
+ signal .connect (async_handler )
634
+
635
+ result = await signal .asend (self .__class__ )
636
+ self .assertEqual (result , [(async_handler , 1 )])
637
+
638
+ async def test_asend_robust_only_async_receivers (self ):
639
+ async_handler = AsyncHandler ()
640
+ signal = dispatch .Signal ()
641
+ signal .connect (async_handler )
642
+
643
+ result = await signal .asend_robust (self .__class__ )
644
+ self .assertEqual (result , [(async_handler , 1 )])
You can’t perform that action at this time.
0 commit comments