Author vstinner
Recipients giampaolo.rodola, gvanrossum, pitrou, vstinner, yselivanov, zach.ware
Date 2014-07-30.10:08:04
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
> It may be related to the issue #17911.

I checked: it is. The strange reference count can be seen with a single test. Example:

$ ./python -m test -R 3:3: -m test_default_exc_handler_coro test_asyncio 
[1/1] test_asyncio
beginning 6 repetitions
test_asyncio leaked [53, 53, -106] references, sum=0
test_asyncio leaked [15, 15, -30] memory blocks, sum=0
1 test failed:

This test uses a coroutine which raises an exception. The exception is stored in a Task object. But the exception contains also a traceback which indirectly creates a reference cycle. For example, the zero_error_coro() coroutine of the test uses the free variable "self".

It's very difficult to find all objects of a reference cycle. We can try to break some cycles, it's already done Task._step() which sets self to None, but it's a waste of time. IMO the correct fix is to not store frame objects in an exception: see the issue #17911.
Date User Action Args
2014-07-30 10:08:04vstinnersetrecipients: + vstinner, gvanrossum, pitrou, giampaolo.rodola, zach.ware, yselivanov
2014-07-30 10:08:04vstinnersetmessageid: <>
2014-07-30 10:08:04vstinnerlinkissue22104 messages
2014-07-30 10:08:04vstinnercreate