Opened 3 months ago

Last modified 5 days ago

#35844 assigned New feature

Python 3.14 compatibility.

Reported by: Mariusz Felisiak Owned by: Mariusz Felisiak
Component: Core (Other) Version: dev
Severity: Normal Keywords:
Cc: 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.14 final is scheduled for October 2025 (see ​PEP 745). This is a tracking ticket for compatibility fixes for Django submitted in the meantime.

Django 5.2 will be the first version to support Python 3.14, because Django 5.1 will end the mainstream support in April 2024.

Change History (15)

comment:1 by Claude Paroz, 3 months ago

Triage Stage: UnreviewedAccepted
Version: 5.0dev

comment:2 by Mariusz Felisiak, 3 months ago

Initial PRs:

After applying these 3 changes we'll have one more deprecation warning, 49 test failures, and 24 test errors. All of them are under investigation of Team Venus of the 3rd Djangonauts cohort, PRs will be submitted soonish :)

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

In 48fa531:

Refs #35844 -- Added Python 3.14 to daily builds.

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

In bd3b1dfa:

Refs #35844 -- Used asgiref.sync.iscoroutinefunction() instead of deprecated asyncio.iscoroutinefunction().

Fixes DeprecationWarning:

'asyncio.iscoroutinefunction' is deprecated and slated for removal in
Python 3.16; use inspect.iscoroutinefunction() instead.

comment:5 by GitHub <noreply@…>, 3 months ago

In 34066d6:

Refs #35844 -- Fixed tests for test --parallel option on Python 3.14+.

"forkserver" is the new default on POSIX systems, and Django doesn't
support parallel tests with "forkserver":

https://github.com/python/cpython/commit/b65f2cdfa77d8d12c213aec663ddaaa30d75a4b2

comment:6 by Sarah Boyce <42296566+sarahboyce@…>, 3 months ago

In 4c3897b:

Refs #35844 -- Corrected expected error messages in commands tests on Python 3.14+.

Updated CommandTests.test_subparser_invalid_option and CommandDBOptionChoiceTests.test_invalid_choice_db_option to address changes in Python 3.14+ error handling.

comment:7 by Mariusz Felisiak, 3 months ago

FYI: urljoin() behavior change has been accepted as a regression in Python 3.14, https://github.com/python/cpython/issues/125926.

comment:8 by Claude Paroz <claude@…>, 3 months ago

In fc22fdd3:

Refs #35844 -- Expanded compatibility for expected error messages in command tests on Python 3.12 and 3.13.

Updated CommandTests.test_subparser_invalid_option and CommandDBOptionChoiceTests.test_invalid_choice_db_option to use assertRaisesRegex() for compatibility with modified error messages in Python 3.12, 3.13, and 3.14+..

comment:9 by Sarah Boyce <42296566+sarahboyce@…>, 3 months ago

In b57a839:

[5.1.x] Refs #35844 -- Expanded compatibility for expected error messages in command tests on Python 3.12 and 3.13.

Updated CommandTests.test_subparser_invalid_option and CommandDBOptionChoiceTests.test_invalid_choice_db_option to use assertRaisesRegex() for compatibility with modified error messages in Python 3.12, 3.13, and 3.14+..

Backport of fc22fdd34f1e55adde161f5f2dca8db90bbfce80 from main.

comment:10 by Sarah Boyce <42296566+sarahboyce@…>, 3 months ago

In 5064ddb:

[5.0.x] Refs #35844 -- Expanded compatibility for expected error messages in command tests on Python 3.12.

Updated CommandTests.test_subparser_invalid_option and CommandDBOptionChoiceTests.test_invalid_choice_db_option to use assertRaisesRegex() for compatibility with modified error messages in Python 3.12, 3.13, and 3.14+..

Backport of fc22fdd34f1e55adde161f5f2dca8db90bbfce80 from main.

comment:11 by Sarah Boyce <42296566+sarahboyce@…>, 3 months ago

In ea4a1fb:

[4.2.x] Refs #35844 -- Expanded compatibility for expected error messages in command tests on Python 3.12.

Updated CommandTests.test_subparser_invalid_option and CommandDBOptionChoiceTests.test_invalid_choice_db_option to use assertRaisesRegex() for compatibility with modified error messages in Python 3.12, 3.13, and 3.14+..

Backport of fc22fdd34f1e55adde161f5f2dca8db90bbfce80 from main.

in reply to:  7 comment:12 by Mariusz Felisiak, 2 months ago

Replying to Mariusz Felisiak:

FYI: urljoin() behavior change has been accepted as a regression in Python 3.14, https://github.com/python/cpython/issues/125926.

Fixed in https://github.com/python/cpython/commit/dbb6e22cb1f533bba00a61a5b63ec68af9d48836.

comment:13 by Sarah Boyce <42296566+sarahboyce@…>, 2 months ago

In 8d7b142:

Refs #35844 -- Fixed copying BaseContext and its subclasses on Python 3.14+.

super objects are copyable on Python 3.14+:

https://github.com/python/cpython/commit/5ca4e34bc1aab8321911aac6d5b2b9e75ff764d8

and can no longer be used in BaseContext.copy().

comment:14 by Sarah Boyce <42296566+sarahboyce@…>, 4 weeks ago

In fcd9d08:

Refs #35844 -- Fixed OtherModelFormTests.test_prefetch_related_queryset() test on Python 3.14+.

https://github.com/python/cpython/commit/5a23994a3dbee43a0b08f5920032f60f38b63071

comment:15 by GitHub <noreply@…>, 5 days ago

In 0a341125:

Refs #35844 -- Removed unnecessary ArgumentParser.add_argument_group()'s prefix_chars argument.

The prefix_chars argument is deprecated since https://github.com/python/cpython/commit/7b04496e5c7ed47e9653f4591674fc9ffef34587.

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