Opened 9 months ago

Last modified 2 months ago

#31040 new New feature

Python 3.9 compatibility

Reported by: felixxm Owned by: nobody
Component: Core (Other) Version: master
Severity: Normal Keywords:
Cc: Triage Stage: Someday/Maybe
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Python 3.9 final is scheduled for October 2020. This is a tracking ticket for compatibility fixes for Django submitted in the meantime.

Change History (8)

comment:1 Changed 7 months ago by GitHub <noreply@…>

In 1960d55:

Refs #31040 -- Fixed crypt.crypt() call in test_hashers.py.

An empty string is invalid salt in Python 3 and raises exception since
Python 3.9, see https://bugs.python.org/issue38402.

comment:2 Changed 7 months ago by Mariusz Felisiak <felisiak.mariusz@…>

In 09b4224e:

[3.0.x] Refs #31040 -- Fixed crypt.crypt() call in test_hashers.py.

An empty string is invalid salt in Python 3 and raises exception since
Python 3.9, see https://bugs.python.org/issue38402.
Backport of 1960d55f8baa412b43546d15a8342554808fff57 from master

comment:3 Changed 4 months ago by GitHub <noreply@…>

In 195e0cb:

Refs #31040 -- Used 402 HTTP status in middleware_exceptions tests.

HTTP status code 418 - "I'm a Teaport" was added to http.HTTPStatus in
Python 3.9.0a5 [1] that caused failures in middleware_exceptions tests.

This changes HTTP status used in middleware_exceptions tests to 402,
which exists in all supported versions of Python.

[1] https://docs.python.org/3.9/whatsnew/3.9.html#http

comment:4 Changed 3 months ago by felixxm

handlers.tests.AsyncHandlerRequestTests.test_suspiciousop_in_view_returns_400 hangs on Python 3.9.0b1 (it works on Python 3.9.0.a6), see https://bugs.python.org/issue40696.

comment:5 Changed 3 months ago by Chris Jerdonek

While the cause of the test_suspiciousop_in_view_returns_400 failure will be fixed in CPython, I recommend that you review the Django code that was triggering it. Django's exception handling code was raising an exception that was creating a cycle in the exception chain (by re-raising an exception that was already being handled). You might want to reconsider whether there is a better solution. You can see the linked Python issue for some analysis I did of the code on the Django side.

comment:6 Changed 3 months ago by felixxm

PR for preventing cycles in exception chains.

comment:7 Changed 2 months ago by GitHub <noreply@…>

In d94a9aa:

Refs #31040, Refs #31224 -- Prevented cycles in exceptions chain.

Async exception handling was raising an exception that was creating a
cycle in the exception chain (by re-raising an exception in
sync_to_async that was already being handled).

Thanks Chris Jerdonek for detailed analysis.

comment:8 Changed 2 months ago by Mariusz Felisiak <felisiak.mariusz@…>

In bd389a8:

[3.1.x] Refs #31040, Refs #31224 -- Prevented cycles in exceptions chain.

Async exception handling was raising an exception that was creating a
cycle in the exception chain (by re-raising an exception in
sync_to_async that was already being handled).

Thanks Chris Jerdonek for detailed analysis.
Backport of d94a9aa0557a459a5b9b7b82a8c043de14f8b1a0 from master

Note: See TracTickets for help on using tickets.
Back to Top