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.

classification
Title: Unexpected stderr output from test_sys_settrace
Type: behavior Stage: resolved
Components: Tests Versions: Python 3.8
process
Status: closed Resolution: out of date
Dependencies: Superseder:
Assigned To: Nosy List: Philip Dye, asvetlov, iritkatriel, ncoghlan, shihai1991, yselivanov
Priority: low Keywords:

Created on 2019-04-21 13:33 by ncoghlan, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Messages (5)
msg340608 - (view) Author: Nick Coghlan (ncoghlan) * (Python committer) Date: 2019-04-21 13:33
The test output from test_sys_settrace makes it look like a couple of the async tracing tests aren't cleaning up after themselves properly:

```
[ncoghlan@localhost cpython]$ ./python -m test test_sys_settrace
Run tests sequentially
0:00:00 load avg: 1.27 [1/1] test_sys_settrace
unhandled exception during asyncio.run() shutdown
task: <Task finished name='Task-8' coro=<<async_generator_athrow without __name__>()> exception=RuntimeError("can't send non-None value to a just-started coroutine")>
RuntimeError: can't send non-None value to a just-started coroutine
unhandled exception during asyncio.run() shutdown
task: <Task finished name='Task-11' coro=<<async_generator_athrow without __name__>()> exception=RuntimeError("can't send non-None value to a just-started coroutine")>
RuntimeError: can't send non-None value to a just-started coroutine

== Tests result: SUCCESS ==

1 test OK.

Total duration: 102 ms
Tests result: SUCCESS

```

If that output is actually expected as part of the test, it would be helpful if the test printed a message beforehand saying to expect it. Otherwise, it would be desirable for the test to clean up after itself and keep the messages from being displayed in the first place.
msg348437 - (view) Author: Hai Shi (shihai1991) * (Python triager) Date: 2019-07-25 13:24
It looks like setstrace function trigger this codeline: https://github.com/python/cpython/blob/master/Modules/_asynciomodule.c#L2618

Looks we can use set_exception_handler() to catch this error, but i am not sure it is worth catching this error through adding  a extended exception hander.

so, Nick, what's your thought?

REF: https://github.com/python/cpython/blob/master/Lib/asyncio/base_events.py#L1627
msg348544 - (view) Author: Philip Dye (Philip Dye) Date: 2019-07-27 14:21
Once consensus is reached, I would be happy to do the work.
msg415837 - (view) Author: Irit Katriel (iritkatriel) * (Python committer) Date: 2022-03-22 23:00
I'm not seeing this output when I run the test. Are you still seeing it?
msg416367 - (view) Author: Nick Coghlan (ncoghlan) * (Python committer) Date: 2022-03-30 14:47
I'm not, so I assume this got cleaned up somewhere along the way.
History
Date User Action Args
2022-04-11 14:59:14adminsetgithub: 80873
2022-03-30 14:47:38ncoghlansetstatus: pending -> closed
resolution: out of date
messages: + msg416367

stage: needs patch -> resolved
2022-03-22 23:00:04iritkatrielsetstatus: open -> pending
nosy: + iritkatriel
messages: + msg415837

2019-07-27 14:21:58Philip Dyesetnosy: + Philip Dye
messages: + msg348544
2019-07-25 13:24:50shihai1991setnosy: + shihai1991
messages: + msg348437
2019-04-21 13:33:08ncoghlancreate