[Python-ideas] PEP 3156/Tulip: Extensible EventLoop interface

Guido van Rossum guido at python.org
Wed Feb 6 23:43:54 CET 2013


On Wed, Feb 6, 2013 at 1:48 PM, Richard Oudkerk <shibturn at gmail.com> wrote:
> On 06/02/2013 9:23pm, Yuval Greenfield wrote:
>>
>> Strangely, the first time I run the tests I get a big pile of output
>> exceptions though the tests do pass. E.g.
>>
>> .........sss......ss.ERROR:root:Exception in task
>> Traceback (most recent call last):
>>    File "E:\Dropbox\dev\python\tulip\tulip\tasks.py", line 96, in _step
>>      result = coro.send(value)
>>    File "E:\Dropbox\dev\python\tulip\tulip\base_events.py", line 235, in
>> create_c
>> onnection
>>      raise exceptions[0]
>>    File "E:\Dropbox\dev\python\tulip\tulip\base_events.py", line 226, in
>> create_c
>> onnection
>>      yield self.sock_connect(sock, address)
>>    File "c:\python33\lib\unittest\mock.py", line 846, in __call__
>>      return _mock_self._mock_call(*args, **kwargs)
>>    File "c:\python33\lib\unittest\mock.py", line 901, in _mock_call
>>      raise effect
>> OSError
>> .ERROR:root:Exception in task
>> [...]
>
>
> I see this sometimes too.
>
> It seems that these are expected errors caused by using
> self.assertRaises(...).  Why these errors are logged only sometimes I don't
> understand.

Me neither. :-(

The message "Exception in task" means that it is a task that raises an
exception. I used to ignore these; now I log them always, but ideally
they should only be logged when whoever waits for the Task doesn't
catch them (or, better, when nobody waits for the task). I tried to
implement that part but I couldn't get it to work (yet) -- I will have
to get back to this at some point, because accurate exception logging
(never silent, but not too spammy either) is very important for a good
user experience.

But it remains a mystery why they sometimes show and not other times.
It suggests there's some indeterminate timing in some tests. If it
happens only the first time when the tests are run this usually points
to a timing behavior that's different when the source code is parsed
as opposed to read from a .pyc file.

-- 
--Guido van Rossum (python.org/~guido)



More information about the Python-ideas mailing list