GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — gh-94912: Adjusted check for non-standard coroutine function marker. by carltongibson · Pull Request #100935 · python/cpython

Conversation

@carltongibson

@carltongibson carltongibson commented Jan 11, 2023 •
edited by bedevere-bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

The initial implementation did not correctly identify explicitly marked class instances.

Follow up to 532aa4e from #99247
(Bug in Python 3.12.0a4)

Integrating Python 3.12.0a4 with the Django test suite we see that the _has_coroutine_mark() is not allowing the key case of a class being marked as an asynchronous callable. (This is my fault: in the discussion with @gvanrossum on #99247 over whether we'd cover the marked and async def __call__ cases automatically, I forgot to add the explicit test for the marked instances.)

I note the isfunction(f) or _signature_is_functionlike(f) restriction is untested, and not, I think, necessary. (If folks applied markcoroutinefunction, I think we have to assume that they know what they're up to.)

  • Issue: make asyncio.iscoroutinefunction a deprecated alias of inspect.iscoroutinefunction and remove asyncio.coroutines._is_coroutine #94912

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@carltongibson
pythongh-94912: Adjusted check for non-standard coroutine function ma…
7b6889a
…rker.

The initial implementation did not correctly identify explicitly
marked class instances.

Follow up to 532aa4e
@bedevere-bot bedevere-bot added the awaiting review label Jan 11, 2023
@bedevere-bot bedevere-bot mentioned this pull request Jan 11, 2023
make asyncio.iscoroutinefunction a deprecated alias of inspect.iscoroutinefunction and remove asyncio.coroutines._is_coroutine #94912
Closed
@carltongibson

carltongibson commented Jan 11, 2023

Copy link
Copy Markdown
Contributor Author

I think this could skip news? 🤔

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@kumaraditya303
kumaraditya303 requested a review from gvanrossum January 11, 2023 10:16
@felixxm

felixxm commented Jan 11, 2023

Copy link
Copy Markdown
Contributor

Confirming this resolves the issues for Django ✔️ Thanks!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

sobolevn
sobolevn reviewed Jan 11, 2023
View reviewed changes
Comment thread Lib/inspect.py
while ismethod(f):
f = f.__func__
f = functools._unwrap_partial(f)
if not (isfunction(f) or _signature_is_functionlike(f)):

@sobolevn sobolevn Jan 11, 2023 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

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.

What else can we mark as coroutine-like? Functions, methods, other callables like partial, classes. Anything else?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@carltongibson carltongibson Jan 11, 2023

Copy link
Copy Markdown
Contributor Author

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.

Hi @sobolevn. I'm not sure I follow 🤔

The cases that have occurred up to Python 3.11, using the old asyncio version, have been callable classes and sync functions. Those are (now) covered. We also added tests for static and class method and lambdas (but I've not seen anyone using those).

The other case that would simplify client code is automatic detection of the __call__ method (either async def or marked) but I think the preference is not to add that.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@gvanrossum gvanrossum added the skip news label Jan 11, 2023
gvanrossum
gvanrossum approved these changes Jan 11, 2023
View reviewed changes

@gvanrossum gvanrossum left a comment

Copy link
Copy Markdown
Member

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. I will merge this.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

carltongibson reacted with heart emoji
All reactions
  • ❤️ 1 reaction
@bedevere-bot bedevere-bot added awaiting merge and removed awaiting review labels Jan 11, 2023
@gvanrossum
gvanrossum merged commit 07a87f7 into python:main Jan 11, 2023
@bedevere-bot bedevere-bot removed the awaiting merge label Jan 11, 2023
@carltongibson
carltongibson deleted the fix-issue-94912 branch January 22, 2023 13:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@sobolevn sobolevn sobolevn left review comments
@gvanrossum gvanrossum gvanrossum approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

skip news

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

5 participants

@carltongibson @felixxm @gvanrossum @sobolevn @bedevere-bot
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.