Merged
Conversation
…y/sentry-python into antonpirker/asyncio-integration
sl0thentr0py
requested changes
Oct 12, 2022
sl0thentr0py
requested changes
Oct 14, 2022
Co-authored-by: Neel Shah <neelshah.sa@gmail.com>
sl0thentr0py
requested changes
Oct 17, 2022
sentry_sdk/integrations/asyncio.py
Outdated
| # WARNING: | ||
| # If the default behavior of the task creation in asyncio changes, | ||
| # this will break! | ||
| task = Task(_coro_creating_hub_and_span(), loop=loop) |
Member
There was a problem hiding this comment.
shouldn't this be
Suggested change
| task = Task(_coro_creating_hub_and_span(), loop=loop) | |
| task = Task(_coro_creating_hub_and_span, loop=loop) |
Member
There was a problem hiding this comment.
but how did it work before lol
Contributor
There was a problem hiding this comment.
How does it work now, actually 😄 The correct version is the first one.
In [1]: from asyncio import Task
In [2]: async def foo():
...: print("test")
...:
In [3]: await Task(foo)
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
Input In [3], in <cell line: 1>()
----> 1 await Task(foo)
TypeError: a coroutine was expected, got <function foo at 0x7f7fb9241f30>
In [4]: await Task(foo())
test
Member
There was a problem hiding this comment.
I'm not sure, please test all cases @antonpirker
this is what cpython does
https://github.com/python/cpython/blob/main/Lib/asyncio/base_events.py#L436-L444
Contributor
Author
There was a problem hiding this comment.
Really good catch @vmarkovtsev!
This lead to this fix: #1689
Co-authored-by: Neel Shah <neelshah.sa@gmail.com>
sl0thentr0py
approved these changes
Oct 17, 2022
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Make sure each asyncio task that is run has its own Hub and also creates a span.
Fixes #1333
Fixes #772