-
-
Notifications
You must be signed in to change notification settings - Fork 31.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NameError in asyncio.gather when passing a invalid type as an arg with multiple awaitables #90830
Labels
Comments
It is possible to cause a NameError in asyncio.gather if the second presumed coroutine fails the internal type check. Sample code: import asyncio
async def main():
coros = (asyncio.sleep(1), {1: 1})
await asyncio.gather(*coros)
asyncio.run(main()) Exception in callback gather.<locals>._done_callback(<Task cancell...tasks.py:593>>) at /usr/local/lib/python3.10/asyncio/tasks.py:714
handle: <Handle gather.<locals>._done_callback(<Task cancell...tasks.py:593>>) at /usr/local/lib/python3.10/asyncio/tasks.py:714>
Traceback (most recent call last):
File "/usr/local/lib/python3.10/asyncio/runners.py", line 44, in run
return loop.run_until_complete(main)
File "/usr/local/lib/python3.10/asyncio/base_events.py", line 641, in run_until_complete
return future.result()
File "<string>", line 4, in main
File "/usr/local/lib/python3.10/asyncio/tasks.py", line 775, in gather
if arg not in arg_to_fut:
TypeError: unhashable type: 'dict'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.10/asyncio/events.py", line 80, in _run
self._context.run(self._callback, *self._args)
File "/usr/local/lib/python3.10/asyncio/tasks.py", line 718, in _done_callback
if outer.done():
NameError: free variable 'outer' referenced before assignment in enclosing scope
Traceback (most recent call last):
File "<string>", line 5, in <module>
File "/usr/local/lib/python3.10/asyncio/runners.py", line 44, in run
return loop.run_until_complete(main)
File "/usr/local/lib/python3.10/asyncio/base_events.py", line 641, in run_until_complete
return future.result()
File "<string>", line 4, in main
File "/usr/local/lib/python3.10/asyncio/tasks.py", line 775, in gather
if arg not in arg_to_fut:
TypeError: unhashable type: 'dict' |
hi there, on this issue : https://bugs.python.org/issue46672 I encountered this problem on This fix f1916cd is only available python 3.9 or above? |
Correct. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
NameError
inasyncio.gather
if type check fails #31187NameError
inasyncio.gather
if type check fails (GH-31187) #31440NameError
inasyncio.gather
if type check fails (GH-31187) #31441Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: