Skyscanner / aiotask-context

Contextual information for asyncio tasks
MIT License
161 stars 25 forks source link

Fix for uvloop #8

Closed timka closed 7 years ago

timka commented 7 years ago

Seems the original motivation was reusing code from _check_closed, but this doesn't work with uvloop.

argaen commented 7 years ago

I really don't remember why I added the self._check_closed call there. Having a look both at asyncio and uvloop code, this call is done before the task_factory is called:

https://github.com/python/cpython/blob/21b3e04c13212b29e8c35ffc36eed8603fde08f4/Lib/asyncio/base_events.py#L281

https://github.com/MagicStack/uvloop/blob/45e177555d78066b9d7fa01c0049d89e43b7f794/uvloop/loop.pyx#L1142

do you mind updating your MR removing that line and adding a test that checks that if the loop is closed, a Runtime error is raised? :)

argaen commented 7 years ago

Thanks a lot!

I want to add some tests for checking uvloop compatibility, once done I'll make a new release

timka commented 7 years ago

Awesome!

argaen commented 7 years ago

Just released 0.4.2 with your changes and the uvloop tests

timka commented 7 years ago

Great! Thanks a bunch!