Skyscanner / aiotask-context

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

Python 3.7: PendingDeprecationWarning: Task.current_task() is deprecated, use asyncio.current_task() instead #23

Closed diefans closed 6 years ago

diefans commented 6 years ago

I get a lot of deprecation warning spam in my unit tests, e.g.:

/home/olli/.pyenv/versions/3.7.0/envs/ml-microservice-3.7.0/lib/python3.7/site-packages/aiotask_context/__init__.py:57: PendingDeprecationWarning: Task.current_task() is deprecated, use asyncio.current_task() instead
  context = asyncio.Task.current_task(loop=loop).context
argaen commented 6 years ago

Hi @diefans, do you want to provide a PR fixing this? Its a matter of checking the python version and using asyncio.current_task or asyncio.Task.current_task

diefans commented 6 years ago

@argaen sure

diefans commented 6 years ago

@argaen as it turned out, there were a couple of obstacles I had to fix too...

diefans commented 6 years ago

@argaen any chance to get this merged and released soon?

argaen commented 6 years ago

Hey @diefans I'll try to find some time today for that :)