Title: make `asyncio.iscoroutinefunction` a deprecated alias of `inspect.iscoroutinefunction` and remove `asyncio.coroutines._is_coroutine` · Issue #94912 · python/cpython · GitHub
Open Graph Title: make `asyncio.iscoroutinefunction` a deprecated alias of `inspect.iscoroutinefunction` and remove `asyncio.coroutines._is_coroutine` · Issue #94912 · python/cpython
X Title: make `asyncio.iscoroutinefunction` a deprecated alias of `inspect.iscoroutinefunction` and remove `asyncio.coroutines._is_coroutine` · Issue #94912 · python/cpython
Description: currently asyncio.iscoroutinefunction and inspect.iscoroutinefunction behave differently in confusing and hard to document ways. It's possible to bring them into alignment but I think it would be better to make asyncio.iscoroutinefunctio...
Open Graph Description: currently asyncio.iscoroutinefunction and inspect.iscoroutinefunction behave differently in confusing and hard to document ways. It's possible to bring them into alignment but I think it would be b...
X Description: currently asyncio.iscoroutinefunction and inspect.iscoroutinefunction behave differently in confusing and hard to document ways. It's possible to bring them into alignment but I think it would ...
Opengraph URL: https://github.com/python/cpython/issues/94912
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"make `asyncio.iscoroutinefunction` a deprecated alias of `inspect.iscoroutinefunction` and remove `asyncio.coroutines._is_coroutine`","articleBody":"currently asyncio.iscoroutinefunction and inspect.iscoroutinefunction behave differently in [confusing and hard to document ways](https://github.com/python/cpython/issues/67707). It's possible to bring them into alignment but I think it would be better to make `asyncio.iscoroutinefunction` a deprecated alias of `inspect.iscoroutinefunction` and remove `asyncio.coroutines._is_coroutine`.\r\n\r\nThis is now possible with the recent [removal of `@asyncio.coroutine`](https://github.com/python/cpython/pull/26369) and support for [AsyncMock and other duck-type functions in inspect.iscoroutinefunction](https://github.com/python/cpython/pull/94050)\r\n\r\nthe only caveats are - what should happen to users of the `asyncio.coroutines._is_coroutine` mark? eg:\r\nhttps://github.com/python/cpython/blob/1c0cf0aef4b43b875b0191fd6f8956c929694a1f/Lib/asyncio/tasks.py#L686-L696\r\n\r\nand all of these:\r\n\r\n```\r\nLib/test/test_asyncio/test_base_events.py: m_socket.getaddrinfo._is_coroutine = False\r\nLib/test/test_asyncio/test_base_events.py: self.loop._add_reader._is_coroutine = False\r\nLib/test/test_asyncio/test_base_events.py: self.loop._add_writer._is_coroutine = False\r\nLib/test/test_asyncio/test_base_events.py: self.loop._add_reader._is_coroutine = False\r\nLib/test/test_asyncio/test_base_events.py: self.loop._add_writer._is_coroutine = False\r\nLib/test/test_asyncio/test_base_events.py: self.loop._add_reader._is_coroutine = False\r\nLib/test/test_asyncio/test_base_events.py: self.loop._add_writer._is_coroutine = False\r\nLib/test/test_asyncio/test_base_events.py: m_socket.getaddrinfo._is_coroutine = False\r\nLib/test/test_asyncio/test_base_events.py: m_socket.getaddrinfo._is_coroutine = False\r\nLib/test/test_asyncio/test_base_events.py: self.loop._add_reader._is_coroutine = False\r\nLib/test/test_asyncio/test_selector_events.py: self.loop.add_reader._is_coroutine = False\r\nLib/test/test_asyncio/test_subprocess.py: protocol.connection_made._is_coroutine = False\r\nLib/test/test_asyncio/test_subprocess.py: protocol.process_exited._is_coroutine = False\r\nLib/unittest/mock.py: mock._is_coroutine = asyncio.coroutines._is_coroutine\r\nLib/unittest/mock.py: # iscoroutinefunction() checks _is_coroutine property to say if an\r\nLib/unittest/mock.py: self.__dict__['_is_coroutine'] = asyncio.coroutines._is_coroutine\r\n```\n\n\u003c!-- gh-pr-number: gh-99247 --\u003e\n* PR: gh-99247\n\u003c!-- /gh-pr-number --\u003e\n\n\n\u003c!-- gh-pr-number: gh-100935 --\u003e\n* PR: gh-100935\n\u003c!-- /gh-pr-number --\u003e\n","author":{"url":"https://github.com/graingert","@type":"Person","name":"graingert"},"datePublished":"2022-07-17T00:25:40.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":34},"url":"https://github.com/94912/cpython/issues/94912"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:cce6c9fb-73d3-5b80-b553-78aa5f300d6d |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B35C:2361CC:26CA7E0:36A8F7F:69691A9A |
| html-safe-nonce | 322de02dfe6ef8ec7019afe1c12f9a07f99e924c8a42e0d4335bcd12faa75d60 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCMzVDOjIzNjFDQzoyNkNBN0UwOjM2QThGN0Y6Njk2OTFBOUEiLCJ2aXNpdG9yX2lkIjoiNTc4NDg4NjYyMDkxMjY4Nzc3MCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | d6f28552b70a2ae5f45ca69aa143a4a8adaf93ed89c1cef8c70bed207c5345b6 |
| hovercard-subject-tag | issue:1306947476 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python/cpython/94912/issue_layout |
| twitter:image | https://opengraph.githubassets.com/56b3c9fe75a99b864fa70727fc23ed98a9b930d1b070a6425c532df3a796ef10/python/cpython/issues/94912 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/56b3c9fe75a99b864fa70727fc23ed98a9b930d1b070a6425c532df3a796ef10/python/cpython/issues/94912 |
| og:image:alt | currently asyncio.iscoroutinefunction and inspect.iscoroutinefunction behave differently in confusing and hard to document ways. It's possible to bring them into alignment but I think it would be b... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | graingert |
| hostname | github.com |
| expected-hostname | github.com |
| None | 0e60568924309a021b51adabdce15c2a2f285b556f3130d1a2fa2a5bce11c55f |
| turbo-cache-control | no-preview |
| go-import | github.com/python/cpython git https://github.com/python/cpython.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 81598961 |
| octolytics-dimension-repository_nwo | python/cpython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 81598961 |
| octolytics-dimension-repository_network_root_nwo | python/cpython |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | dd206f7ed6207863172be4a783826e86bd2375c3 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width