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

gh-122858: Deprecate asyncio.iscoroutinefunction #122875

Merged
merged 16 commits into from
Aug 11, 2024

Conversation

Wulian233
Copy link
Contributor

@Wulian233 Wulian233 commented Aug 10, 2024

Same inspect.iscoroutinefunction, we don't need two different functions to do the same thing.

@Wulian233 Wulian233 marked this pull request as draft August 10, 2024 02:52
@Wulian233
Copy link
Contributor Author

Wulian233 commented Aug 10, 2024

After my many fix, maybe it is normal for the Docs workflow to fail because the deprecated function asyncio.iscoroutinefunctiondoes not have a corresponding document page introduction

But I don't know how to solve this problem. Delete whatnew/3.14.rst: func: iscoroutinefunctiondoes?

(Solved)

@Wulian233 Wulian233 marked this pull request as ready for review August 10, 2024 04:15
@cjw296 cjw296 removed their request for review August 10, 2024 09:31
Copy link
Member

@sobolevn sobolevn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, use at least one test that ensures that the function is deprecated (which does not ignore the warnings).

@Wulian233
Copy link
Contributor Author

Wulian233 commented Aug 11, 2024

This is the function that test this function c1f2743 If not have @ignore_warnings(category=DeprecationWarning) this will cause the workflow test to fail (DeprecationWarning). Do you mean to add some kind of tip below, without causing failure?

@ignore_warnings(category=DeprecationWarning)
def test_iscoroutinefunction(self):
    print("asyncio.iscoroutinefunction is deprecated, use inspect.iscoroutinefunction() instead")
    def fn(): 
      ...

(Sorry, I may not be familiar with it)

@kumaraditya303
Copy link
Contributor

I am taking over this now.

@kumaraditya303 kumaraditya303 enabled auto-merge (squash) August 11, 2024 16:15
@kumaraditya303 kumaraditya303 merged commit bc9d92c into python:main Aug 11, 2024
36 checks passed
@Wulian233 Wulian233 deleted the asyncio branch August 11, 2024 23:16
blhsing pushed a commit to blhsing/cpython that referenced this pull request Aug 22, 2024
Deprecate `asyncio.iscoroutinefunction` in favor of `inspect.iscoroutinefunction`.

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
AdamWill pushed a commit to AdamWill/cached-property that referenced this pull request Nov 5, 2024
Python 3.14 will deprecate asyncio.iscoroutinefunction:
python/cpython#122875

inspect.iscoroutinefunction exists since 3.5 and our baseline
is 3.8, so we can just use it unconditionally.

Using a wrapper with @asyncio.coroutine in __get__ wasn't
necessary (the future from asyncio.ensure_future is awaitable,
and the wrapper doesn't do anything asynchronous), so the
logic can be simplified to just call asyncio.ensure_future
(to schedule the task and store the result when it's
available).
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.

3 participants