Visitar URL original
bpo-30491: Add unawaited coroutine tracking mode by njsmith · Pull Request #5279 · python/cpython · GitHub
The Wayback Machine - https://web.archive.org/web/20250624103944/https://github.com/python/cpython/pull/5279
Skip to content

bpo-30491: Add unawaited coroutine tracking mode #5279

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

Closed
wants to merge 1 commit into from

Conversation

njsmith
Copy link
Contributor

@njsmith njsmith commented Jan 23, 2018 •

This provides a fast and easy way to get a list of coroutines that
have been created, but not awaited. For example, a test harness can
use it to reliably check after each test whether it had any missing
'await's (which can otherwise cause spurious test successes).

https://bugs.python.org/issue30491

@njsmith njsmith requested a review from 1st1 as a code owner January 23, 2018 07:28
@njsmith njsmith changed the title bpo-30491: Add unawaited coroutine mode bpo-30491: Add unawaited coroutine tracking mode Jan 23, 2018
This provides a fast and easy way to get a list of coroutines that
have been created, but not awaited. For example, a test harness can
use it to reliably check after each test whether it had any missing
'await's (which can otherwise cause spurious test successes).
@njsmith njsmith force-pushed the unawaited-tracking branch from 04c62df to 3954f61 Compare January 23, 2018 07:29
@@ -1292,6 +1292,66 @@ always available.
The coroutine wrapper functionality has been deprecated, and
will be removed in 3.8. See :issue:`32591` for details.

.. function:: set_unawaited_coroutine_tracking_enabled(enabled)

Enables or disables "unawaited coroutine tracking mode". This is a
Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like the sys page uses the command form, so I believe this should be Enable or disable. Same with the other new function descriptions.

while ((coro = _PyCoro_PopUnawaited())) {
if (PyList_Append(output, coro) < 0) {
Py_DECREF(coro);
return NULL;
Copy link
Contributor

Choose a reason for hiding this comment

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

output is leaked here.

@asvetlov
Copy link
Contributor

Done by https://bugs.python.org/issue32591

@asvetlov asvetlov closed this Mar 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants