This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author njs
Recipients chris.jerdonek, giampaolo.rodola, gvanrossum, mbussonn, ncoghlan, njs, yselivanov
Date 2018-01-24.05:43:22
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1516772603.12.0.467229070634.issue30491@psf.upfronthosting.co.za>
In-reply-to
Content
Thanks for the summary, Yury! One quick note:

> Effectively, the previously merged origin-tracking API (the one with which we replaced set_coroutine_wrapper) achieves the same goal.

I would say the two features are complementary. This feature (unawaited tracking) is cheap (a few % slowdown on microbenchmarks), and lets you find all the unawaited coroutine objects created in a given span of code. Origin-tracking is expensive (~3x slowdown on microbenchmarks with asyncio's default settings), and lets you take a coroutine object and map it back to the exact line of code where it was created. If you have both, then you can find all the coroutine objects and then find their exact origins.

In the testing use case, there are two problems with relying on the GC to issue warnings: (1) because of traceback frame capture, reference cycles, etc., currently "coroutine was never awaited" warnings often (usually?) get attributed to the wrong test. (And yeah, it's even worse on pypy.) (2) because it's just a warning, it's easy to miss entirely -- if you forget an 'await' you can easily get a test that passes because it never actually executed any code (!), and when the tests are green most people don't read the CI logs to check for warnings.

The idea of this feature is it's cheap enough for pytest-asyncio or trio to turn it on by default, and it makes the detection deterministic, so e.g. pytest-asyncio can reliably figure out which test caused the problem and mark it as FAILed. Then if it you also turn on origin-tracking, it can further narrow that down to the exact line in the test that caused the failure.
History
Date User Action Args
2018-01-24 05:43:23njssetrecipients: + njs, gvanrossum, ncoghlan, giampaolo.rodola, chris.jerdonek, yselivanov, mbussonn
2018-01-24 05:43:23njssetmessageid: <1516772603.12.0.467229070634.issue30491@psf.upfronthosting.co.za>
2018-01-24 05:43:23njslinkissue30491 messages
2018-01-24 05:43:22njscreate