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

Added Python 3.12 support. #412

Merged
merged 1 commit into from
Oct 13, 2023
Merged

Added Python 3.12 support. #412

merged 1 commit into from
Oct 13, 2023

Conversation

felixxm
Copy link
Member

@felixxm felixxm commented Oct 12, 2023

No description provided.

@felixxm felixxm changed the title Confirmed Python 3.12 support. Added Python 3.12 support. Oct 12, 2023
@felixxm
Copy link
Member Author

felixxm commented Oct 12, 2023

Waiting for #413 #414.

Copy link
Member

@andrewgodwin andrewgodwin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me code-wise, we're good to merge if the rebase onto #414 gets everything passing.

@felixxm
Copy link
Member Author

felixxm commented Oct 13, 2023

Great, all 🟢 I still have some warnings to investigate:

Task was destroyed but it is pending!
task: <Task pending name='Task-30' coro=<StatelessServer.application_checker() running at /home/runner/work/asgiref/asgiref/asgiref/server.py:136> wait_for=<Future pending cb=[Task.task_wakeup()]>>
Task was destroyed but it is pending!
task: <Task cancelling name='Task-42' coro=<server.<locals>.app() running at /home/runner/work/asgiref/asgiref/tests/test_server.py:81> wait_for=<Future cancelled>>
Task was destroyed but it is pending!
task: <Task cancelling name='Task-43' coro=<server.<locals>.app() running at /home/runner/work/asgiref/asgiref/tests/test_server.py:81> wait_for=<Future cancelled>>
Task was destroyed but it is pending!
task: <Task cancelling name='Task-44' coro=<server.<locals>.app() running at /home/runner/work/asgiref/asgiref/tests/test_server.py:81> wait_for=<Future cancelled>>
Task was destroyed but it is pending!
task: <Task cancelling name='Task-45' coro=<server.<locals>.app() running at /home/runner/work/asgiref/asgiref/tests/test_server.py:81> wait_for=<Future cancelled>>
Task was destroyed but it is pending!
task: <Task cancelling name='Task-46' coro=<server.<locals>.app() running at /home/runner/work/asgiref/asgiref/tests/test_server.py:81> wait_for=<Future cancelled>>
Task was destroyed but it is pending!
task: <Task cancelling name='Task-47' coro=<server.<locals>.app() running at /home/runner/work/asgiref/asgiref/tests/test_server.py:81> wait_for=<Future cancelled>>
Task was destroyed but it is pending!
task: <Task cancelling name='Task-48' coro=<server.<locals>.app() running at /home/runner/work/asgiref/asgiref/tests/test_server.py:81> wait_for=<Future cancelled>>
Task was destroyed but it is pending!
task: <Task cancelling name='Task-49' coro=<server.<locals>.app() running at /home/runner/work/asgiref/asgiref/tests/test_server.py:81> wait_for=<Future cancelled>>
Task was destroyed but it is pending!
task: <Task cancelling name='Task-50' coro=<server.<locals>.app() running at /home/runner/work/asgiref/asgiref/tests/test_server.py:81> wait_for=<Future cancelled>>
Task was destroyed but it is pending!
task: <Task cancelling name='Task-51' coro=<server.<locals>.app() running at /home/runner/work/asgiref/asgiref/tests/test_server.py:81> wait_for=<Future cancelled>>
Task was destroyed but it is pending!
task: <Task cancelling name='Task-52' coro=<server.<locals>.app() running at /home/runner/work/asgiref/asgiref/tests/test_server.py:81> wait_for=<Future cancelled>>

@felixxm
Copy link
Member Author

felixxm commented Oct 13, 2023

Great, all 🟢 I still have some warnings to investigate:

Warning are caused by future for application_instances. Adding cancel() for not done tasks in application_checker() fixes warnings, but that's of course not a solution:

diff --git a/asgiref/server.py b/asgiref/server.py
index 43c28c6..ae81150 100644
--- a/asgiref/server.py
+++ b/asgiref/server.py
@@ -144,6 +144,8 @@ class StatelessServer:
                     except KeyError:
                         # Exception handling might have already got here before us. That's fine.
                         pass
+                else:
+                    details["future"].cancel()
 
     async def application_exception(self, exception, application_details):
         """

I'd like to be more fluent in asyncio 😞

@carltongibson
Copy link
Member

carltongibson commented Oct 13, 2023

<Task cancelling ...

There's an error in the Server code here...

        server.run()
>       assert loop.is_running()
E       assert False

The run_until_complete in Server.run() is shutting the event-loop when handle() exits, and so the futures, whilst cancelled in server.close() (called by the pytest fixture at the end of the test) never get a chance on the event loop to actually cancel. (details["future"].cancelled() never becomes True)

@carltongibson
Copy link
Member

FWIW I don't think this is a PY312 issue.

@andrewgodwin
Copy link
Member

Yeah I think that's been there for a while. Happy to fix it as part of this PR or we can work on it separately.

@felixxm
Copy link
Member Author

felixxm commented Oct 13, 2023

TBH, I don't know how to fix it (and I really tried), so it'd be great if we can do it separately.

@andrewgodwin
Copy link
Member

Yes, that is almost certainly why I did not get it fixed before; there's a whole range of issues like this that only really arise in the CI scenario when things are being rapidly created and deleted.

@andrewgodwin andrewgodwin merged commit ebb1edb into django:main Oct 13, 2023
6 checks passed
@felixxm felixxm deleted the python312 branch October 13, 2023 20:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants