mirror of
https://github.com/home-assistant/core.git
synced 2025-12-24 21:06:19 +00:00
Added recursive detection of functools.partial. (#20284)
This commit is contained in:
committed by
Paulus Schoutsen
parent
9482a6303d
commit
5c208da82e
@@ -259,9 +259,10 @@ class HomeAssistant:
|
||||
"""
|
||||
task = None
|
||||
|
||||
# Check for partials to properly determine if coroutine function
|
||||
check_target = target
|
||||
if isinstance(target, functools.partial):
|
||||
check_target = target.func
|
||||
while isinstance(check_target, functools.partial):
|
||||
check_target = check_target.func
|
||||
|
||||
if asyncio.iscoroutine(check_target):
|
||||
task = self.loop.create_task(target) # type: ignore
|
||||
|
||||
Reference in New Issue
Block a user