Closed
Description
If the function being wrapped uses a kwarg that has the same name as the AsyncToSync.main_wrap
function, it causes the execution to fail with AsyncToSync.main_wrap() got multiple values for argument '<kwarg>'
.
How to reproduce - run the following example:
from asgiref.sync import async_to_sync
@async_to_sync
async def example(context):
pass
example(context=1)
Stacktrace:
Traceback (most recent call last):
File "example.py", line 9, in <module>
example(context=1)
File "<venv>/asgiref/sync.py", line 215, in __call__
awaitable = self.main_wrap(
^^^^^^^^^^^^^^^
TypeError: AsyncToSync.main_wrap() got multiple values for argument 'context'
I have tested this on latest main
, on 3.8.1, 3.7.2, 3.7.1, and 3.7.0 versions of asgiref.
From my investigation, the culprit is #390. I tested on the commit before that PR (fd7a63c) and the bug does not reproduce. So the last working version which does not exhibit the bug is 3.6.0.
Metadata
Metadata
Assignees
Labels
No labels