Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

asyncio.create_task(..., name=...) doesn't work with Python 3.7 #41

Closed
davidjwbbc opened this issue Oct 21, 2022 · 1 comment · Fixed by #42
Closed

asyncio.create_task(..., name=...) doesn't work with Python 3.7 #41

davidjwbbc opened this issue Oct 21, 2022 · 1 comment · Fixed by #42
Labels
bug Something isn't working
Milestone

Comments

@davidjwbbc
Copy link
Contributor

Description

The code is supposed to be compatible with Python 3.7 and above, however the name parameter was only introduced to the asyncio.create_task() function in Python 3.8 and this name parameter is used in the code to make debugging easier.

To Reproduce

Steps to reproduce the behavior:

  1. Run the 5gms-application-server with Python 3.7
  2. Exception shows extra "name" parameter is not understood.

Expected behavior

There should not be an exception when using Python 3.7.

Possible fixes

  1. Change the minimum Python version to 3.8.
    • This would ensure that the minimum requirements are met for the name parameter, but may not be compatible with older OS distributions that don't have a more recent Python 3 version.
  2. Remove the name parameter
    • makes task debugging a little harder due to the use of automatically generated task names.
    • Will make the code work with Python 3.7.
  3. Detect the python version and only pass the name parameter if the version is 3.8 or above.
    • Adds a little more complexity to the code, best achieved by wrapping the asyncio.create_task() in a wrapper function and have different wrapper functions for python 3.7 and python 3.8+ which are chosen at start-up of the program.
  4. Find a backward compatible way to achieve the same effect as using the name parameter.
    • Same code works on Python 3.7 upwards.
    • Code may be more complex, having extra steps when tasks are created in order to set the task name.
@davidjwbbc davidjwbbc added the bug Something isn't working label Oct 21, 2022
@davidjwbbc davidjwbbc added this to the MWC23 milestone Oct 21, 2022
@davidjwbbc
Copy link
Contributor Author

Thanks to @jonniebeeb for spotting this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
No open projects
1 participant