Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

gh-94912: deprecate asyncio.iscoroutinefunction when it behaves differently to inspect.iscoroutinefunction#94923

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Closed

Conversation

@graingert
Copy link
Contributor

@graingertgraingert commentedJul 17, 2022
edited by bedevere-bot
Loading

Copy link
ContributorAuthor

@graingertgraingertJul 17, 2022
edited
Loading

Choose a reason for hiding this comment

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

this will insist on objects being real awaitables rather than virtual awaitables - eg:

importasyncio.tasksimportcollections.abcimportunittest.mock@collections.abc.Awaitable.registerclasssleep_0:def__init__(self):self.__await__=lambda:iter((None, ))asyncdef_wrap_awaitable(awaitable):returnawaitawaitableasyncdefamain():awaitasyncio.ensure_future(sleep_0())# this works currently but with the new code:withunittest.mock.patch("asyncio.tasks._wrap_awaitable",new=_wrap_awaitable):awaitasyncio.ensure_future(sleep_0())# it will breakasyncio.run(amain())

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

this is to fix#94924

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

I'll need to do a doc change for this too

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

cc@hugovk for removals

Copy link
Member

Choose a reason for hiding this comment

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

Please could you add it to a 3.14 section likehttps://docs.python.org/3.12/whatsnew/3.12.html#pending-removal-in-python-3-13 ?

And add a.. deprecated-removed:: 3.12 3.14 to the function in its module rst page.

graingert reacted with heart emoji
Copy link
ContributorAuthor

@graingertgraingertJul 18, 2022
edited
Loading

Choose a reason for hiding this comment

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

@hugovk asyncio.iscoroutinefunction's module rst page was already removed:https://github.com/python/cpython/pull/26369/files#diff-5e9a5bb933b1bd1d6092f7e5adb5c06da7a6792e0597f55f911245acacfce7a7L1025

(oops maybe I shouldn't have approved that PR)

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

This is another very subtle change - before the signature was checked when the function was called - and now the signature is checked when the coro is primed, but I think this is a better behavior and worth it to allowinspect.iscoroutinefunction to work

@graingertgraingertforce-pushed theasyncio-iscoroutinefunction branch from2f61137 to5402f43CompareJuly 18, 2022 14:32
@graingertgraingert changed the titlegh-94912: alias asyncio.iscoroutinefunction to inspect.iscoroutinefunctiongh-94912: deprecate asyncio.iscoroutinefunction when it behaves differently to inspect.iscoroutinefunctionJul 19, 2022
@cjw296cjw296 removed their request for reviewJune 9, 2023 12:59
@graingertgraingert deleted the asyncio-iscoroutinefunction branchAugust 11, 2024 18:27
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@hugovkhugovkhugovk left review comments

@1st11st1Awaiting requested review from 1st11st1 is a code owner

@asvetlovasvetlovAwaiting requested review from asvetlovasvetlov is a code owner

Assignees

No one assigned

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

4 participants

@graingert@hugovk@bedevere-bot@kumaraditya303

[8]ページ先頭

©2009-2025 Movatter.jp