crossbario / crossbario/autobahn-python
nicely_exit doesn't exit nicely with python >=3.7
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 2.5k
- Forks
- 768
- PR merge metrics
- No merged PRs in 30d
Description
From Python 3.7, asyncio.Task.all_tasks() has been moved to asyncio.all_tasks() and asyncio.Task.current_task() has moved to asyncio.current_task()
Therefore, nicely_exit of autobahn/asyncio/component.py doesn't exit so nicely anymore
@asyncio.coroutine
def nicely_exit(signal):
log.info("Shutting down due to {signal}", signal=signal)
tasks = asyncio.Task.all_tasks()
for task in tasks:
# Do not cancel the current task.
if task is not asyncio.Task.current_task():
task.cancel()
and throws the following exception
AttributeError: type object '_asyncio.Task' has no attribute 'all_tasks'
Python >= 3.7
Autobahn 20.7.1
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in autobahn/asyncio/component.py at the nicely_exit function referenced in the issue. Check the asyncio task APIs used there against Python 3.7 and verify that shutdown completes without the reported AttributeError. Done means nicely_exit handles Python 3.7 and later without raising this exception.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 48/100