Opened 4 years ago

Closed 4 years ago

#31040 closed New feature (fixed)

Python 3.9 compatibility

Reported by: Mariusz Felisiak Owned by: Mariusz Felisiak
Component: Core (Other) Version: dev
Severity: Normal Keywords:
Cc: kimsia Triage Stage: Accepted
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 (17)

comment:1 by GitHub <noreply@…>, 4 years ago

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 by Mariusz Felisiak <felisiak.mariusz@…>, 4 years ago

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 by GitHub <noreply@…>, 4 years ago

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 by Mariusz Felisiak, 4 years ago

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 by Chris Jerdonek, 4 years ago

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 by Mariusz Felisiak, 4 years ago

PR for preventing cycles in exception chains.

comment:7 by GitHub <noreply@…>, 4 years ago

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 by Mariusz Felisiak <felisiak.mariusz@…>, 4 years ago

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

comment:9 by Mariusz Felisiak, 4 years ago

Owner: changed from nobody to Mariusz Felisiak
Status: newassigned
Triage Stage: Someday/MaybeAccepted
Last edited 4 years ago by Mariusz Felisiak (previous) (diff)

comment:10 by kimsia, 4 years ago

Cc: kimsia added

comment:11 by Mariusz Felisiak <felisiak.mariusz@…>, 4 years ago

In 87b9a8b:

[2.2.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:12 by Mariusz Felisiak <felisiak.mariusz@…>, 4 years ago

In 01742aa:

[2.2.x] Refs #31040 -- Fixed Python PendingDeprecationWarning in select_for_update.tests.

Backport of 0dd2308cf6f559a4f4b50edd7c005c7cf025d1aa from master

comment:13 by GitHub <noreply@…>, 4 years ago

In e18156b6:

Refs #31040 -- Doc'd Python 3.9 compatibility.

comment:14 by Mariusz Felisiak <felisiak.mariusz@…>, 4 years ago

In 84685e51:

[3.1.x] Refs #31040 -- Doc'd Python 3.9 compatibility.

Backport of e18156b6c35908f2a4026287b5225a6a4da8af1a from master.

comment:15 by Mariusz Felisiak <felisiak.mariusz@…>, 4 years ago

In 301bca9:

[3.0.x] Refs #31040 -- Doc'd Python 3.9 compatibility.

Backport of e18156b6c35908f2a4026287b5225a6a4da8af1a from master.

comment:16 by Mariusz Felisiak <felisiak.mariusz@…>, 4 years ago

In b4b8ca48:

[2.2.x] Refs #31040 -- Doc'd Python 3.9 compatibility.

Backport of e18156b6c35908f2a4026287b5225a6a4da8af1a from master.

comment:17 by Mariusz Felisiak, 4 years ago

Resolution: fixed
Status: assignedclosed
Note: See TracTickets for help on using tickets.
Back to Top