dabeaz / curio

Good Curio!
Other
4.02k stars 241 forks source link

Exception raised while exiting a TimeoutAfter context manager #263

Closed rapha-opensource closed 6 years ago

rapha-opensource commented 6 years ago

TypeError: '>' not supported between instances of 'NoneType' and 'float'

It shows up here: https://github.com/dabeaz/curio/blob/97475342e4f6b4d56e9a0393db8472e7dcd68bfa/curio/task.py#L839

It's part of a unit test that does something like this:

i = 0
async with timeout_after(1):
      try:
           while True:
                 self.assertEqual( 'yo mama', await echo('yo mama') )
                 i += 1
      except TimeoutCancellationError:
           pass

This runs most of the time, but once every 4-5 times, it throws. I have not dug more deeply yet, hoping that the problem might jump to someone's eyes first. My 'echo' coroutine function involves more complicated stuff (Channels, network, etc.) though it is not obvious to me how that would be causing the problem.

dabeaz commented 6 years ago

Pushed a possible fix for this. Try and let me know if the problem goes away.

rapha-opensource commented 6 years ago

The problem went away. Thank you for the quick turnaround!