Skip to content
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

Switch from asyncio.iscoroutinefunction to inspect. #637

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

frenzymadness
Copy link

The former causes: DeprecationWarning:
'asyncio.iscoroutinefunction' is deprecated and slated for removal in Python 3.16; use inspect.iscoroutinefunction() instead.

Fixes: #635

What do these changes do?

See the description in the commit message.

Are there changes in behavior for the user?

No

Related issue number

#635

Checklist

  • I think the code is well written
  • Unit tests for the changes exist
  • Documentation reflects the changes

@Dreamsorcerer
Copy link
Member

3.14 is still failing due to the same function call happening in pytest-asyncio.
Older versions are failing because the inspect function doesn't seem to behave the same (hopefully only on older releases...).

@frenzymadness frenzymadness force-pushed the fix_pendingdeprecationwarning branch from 2a84d89 to ec1c2b9 Compare January 21, 2025 11:48
The former causes: DeprecationWarning:
'asyncio.iscoroutinefunction' is deprecated and slated for removal
in Python 3.16; use inspect.iscoroutinefunction() instead.

Fixes: aio-libs#635
@frenzymadness frenzymadness force-pushed the fix_pendingdeprecationwarning branch from ec1c2b9 to c2a83bb Compare January 21, 2025 11:51
@frenzymadness
Copy link
Author

I've implemented it in a way that older Pythons use the old way. pytest-asyncio is already fixed in the latest version: pytest-dev/pytest-asyncio@d043698 but I'm afraid it will cause the same issue for older Python as we saw here. Let's see what the tests tell us.

Copy link

codecov bot commented Jan 21, 2025

Codecov Report

Attention: Patch coverage is 70.00000% with 3 lines in your changes missing coverage. Please review.

Project coverage is 96.57%. Comparing base (f60bf71) to head (a094f1e).
Report is 89 commits behind head on master.

Files with missing lines Patch % Lines
async_lru/__init__.py 40.00% 2 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #637      +/-   ##
==========================================
- Coverage   96.88%   96.57%   -0.31%     
==========================================
  Files          12       12              
  Lines         770      788      +18     
  Branches       91       32      -59     
==========================================
+ Hits          746      761      +15     
- Misses         22       24       +2     
- Partials        2        3       +1     
Flag Coverage Δ
unit 96.44% <70.00%> (-0.31%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Dreamsorcerer
Copy link
Member

Ah, Dependabot got stuck from 3.8 still being in the tests. Let me clear the Dependabot PRs quickly, which will get us an updated pytest-asyncio.

@Dreamsorcerer
Copy link
Member

Looks like pytest-asyncio still needs some updates. Now it's DeprecationWarning: 'asyncio.get_event_loop_policy' is deprecated and slated for removal in Python 3.16.

@frenzymadness
Copy link
Author

Reported: pytest-dev/pytest-asyncio#1049

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DeprecationWarning: asyncio.iscoroutinefunction
2 participants