gh-122858: Deprecate asyncio.iscoroutinefunction by Wulian233 · Pull Request #122875 · python/cpython (original) (raw)

Conversation

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

[ Show hidden characters]({{ revealButtonHref }})

Wulian233

@Wulian233

…ect.iscoroutinefunction`.

@Wulian233

@Wulian233

@Wulian233

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)

kumaraditya303

kumaraditya303

@kumaraditya303

kumaraditya303

@Wulian233

@Wulian233

kumaraditya303

@kumaraditya303

kumaraditya303

@Wulian233

kumaraditya303

kumaraditya303

sobolevn

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

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

I am taking over this now.

@kumaraditya303

kumaraditya303

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

@encukou @AdamWill

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).

layday added a commit to layday/aiohttp that referenced this pull request

Mar 29, 2025

@layday

This was referenced

Mar 29, 2025

Reviewers

@sobolevn sobolevn sobolevn left review comments

@kumaraditya303 kumaraditya303 kumaraditya303 approved these changes

@1st1 1st1 Awaiting requested review from 1st1 1st1 is a code owner

@asvetlov asvetlov Awaiting requested review from asvetlov asvetlov is a code owner

@gvanrossum gvanrossum Awaiting requested review from gvanrossum

@willingc willingc Awaiting requested review from willingc willingc is a code owner