-
Notifications
You must be signed in to change notification settings - Fork 5.3k
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
Replaced asyncio.coroutines.iscoroutinefunction
with inspect.iscoroutinefunction
#1267
Replaced asyncio.coroutines.iscoroutinefunction
with inspect.iscoroutinefunction
#1267
Conversation
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #1267 +/- ##
===========================================
+ Coverage 32.11% 51.09% +18.98%
===========================================
Files 32 32
Lines 4391 4392 +1
Branches 1024 1079 +55
===========================================
+ Hits 1410 2244 +834
+ Misses 2865 1944 -921
- Partials 116 204 +88
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Thanks!
Why are these changes needed?
In several places
asyncio.coroutines.iscoroutinefunction
was used instead ofinspect.iscoroutinefunction
.Both
asyncio.coroutines.iscoroutinefunction
andinspect.iscoroutinefunction
are used to check if a function is a coroutine function. However, they differ in the types of functions they consider to be coroutine functions.inspect.iscoroutinefunction
considers a function to be a coroutine function if it is either:async def
@asyncio.coroutine
asyncio.coroutines.iscoroutinefunction
only considers a function to be a coroutine function if it is decorated with@asyncio.coroutine
. It does not consider functions decorated withasync def
to be coroutine functions.See e.g. https://stackoverflow.com/questions/59343239/asyncio-iscoroutinefunction-returns-false-for-asynchronous-generator
Related issue number
Closes #1260
Checks