Django 4.2 will be the first version to support Python 3.12, because
Django 4.1 will end the mainstream support in April 2023.
--
Ticket URL: <https://code.djangoproject.com/ticket/34118>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* cc: bcail (added)
--
Ticket URL: <https://code.djangoproject.com/ticket/34118#comment:1>
* cc: David Sanders (added)
--
Ticket URL: <https://code.djangoproject.com/ticket/34118#comment:2>
Comment (by David Sanders):
I'm getting errors on the following which was working for 3.11.0
{{{
tests main % python --version
Python 3.11.0
tests main % ./runtests.py
queries.tests.Queries1Tests.test_avoid_infinite_loop_on_too_many_subqueries
Testing against Django installed in
'/Users/dsanders/projects/django/django' with up to 10 processes
Found 1 test(s).
Creating test database for alias 'default'...
System check identified no issues (1 silenced).
.
----------------------------------------------------------------------
Ran 1 test in 0.295s
OK
Destroying test database for alias 'default'...
… 8< … switch venvs
tests main % python --version
Python 3.12.0a1
tests main % ./runtests.py
queries.tests.Queries1Tests.test_avoid_infinite_loop_on_too_many_subqueries
Testing against Django installed in
'/Users/dsanders/projects/django/django' with up to 10 processes
Found 1 test(s).
Creating test database for alias 'default'...
System check identified no issues (1 silenced).
F
======================================================================
FAIL: test_avoid_infinite_loop_on_too_many_subqueries
(queries.tests.Queries1Tests.test_avoid_infinite_loop_on_too_many_subqueries)
----------------------------------------------------------------------
RecursionError: maximum recursion depth exceeded
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/dsanders/projects/django/tests/queries/tests.py", line 550,
in test_avoid_infinite_loop_on_too_many_subqueries
with self.assertRaisesMessage(RecursionError, msg):
File
"/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/contextlib.py",
line 155, in __exit__
self.gen.throw(value)
File "/Users/dsanders/projects/django/django/test/testcases.py", line
890, in _assert_raises_or_warns_cm
self.assertIn(expected_message, str(getattr(cm, cm_attr)))
AssertionError: 'Maximum recursion depth exceeded: too many subqueries.'
not found in 'maximum recursion depth exceeded'
----------------------------------------------------------------------
Ran 1 test in 0.207s
FAILED (failures=1)
Destroying test database for alias 'default'...
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/34118#comment:3>
Comment (by bcail):
Another data point: SQLite and Postgres tests pass for me on Linux with
Python 3.12 alpha 1.
--
Ticket URL: <https://code.djangoproject.com/ticket/34118#comment:4>
Comment (by GitHub <noreply@…>):
In [changeset:"67504ea505797f515fb51c9688ce746c0997e9b2" 67504ea5]:
{{{
#!CommitTicketReference repository=""
revision="67504ea505797f515fb51c9688ce746c0997e9b2"
Refs #34118 -- Skipped not compatible requirements on daily builds for
Python 3.12.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/34118#comment:5>
Comment (by GitHub <noreply@…>):
In [changeset:"2848e5d0ce5cf3c31fe87525536093b21d570f69" 2848e5d]:
{{{
#!CommitTicketReference repository=""
revision="2848e5d0ce5cf3c31fe87525536093b21d570f69"
Refs #34118 -- Used smtplib's context parameter instead of keyfile and
certfile.
keyfile and certfile parameters were removed in Python 3.12, see
https://github.com/python/cpython/commit/ef0e72b31d22f780d3a165d7d0471806061fe380
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/34118#comment:6>
Comment (by GitHub <noreply@…>):
In [changeset:"32d70b2f55b1f74736fd11bc8efce890ad5fa2f0" 32d70b2]:
{{{
#!CommitTicketReference repository=""
revision="32d70b2f55b1f74736fd11bc8efce890ad5fa2f0"
Refs #34118 -- Adopted asgiref coroutine detection shims.
Thanks to Mariusz Felisiak for review.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/34118#comment:7>
Comment (by GitHub <noreply@…>):
In [changeset:"829f4d1448f7b40238b47592fc17061bf77b0f23" 829f4d1]:
{{{
#!CommitTicketReference repository=""
revision="829f4d1448f7b40238b47592fc17061bf77b0f23"
Refs #31546, Refs #34118 -- Corrected
CommandTests.test_requires_system_checks_specific().
System checks are never called without skip_checks=False. Moreover,
called_once_with() is not a proper assertion and raise AttributeError
on Python 3.12.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/34118#comment:8>
Comment (by GitHub <noreply@…>):
In [changeset:"38e63c9e61152682f3ff982c85a73793ab6d3267" 38e63c9]:
{{{
#!CommitTicketReference repository=""
revision="38e63c9e61152682f3ff982c85a73793ab6d3267"
Refs #34118 -- Fixed CustomChoicesTests.test_uuid_unsupported on Python
3.12+.
https://github.com/python/cpython/commit/2a4d8c0a9e88f45047da640ce5a92b304d2d39b1
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/34118#comment:9>
Comment (by Mariusz Felisiak <felisiak.mariusz@…>):
In [changeset:"32cfa73c6a7264a0b6365cc380ca0b257b6fc07a" 32cfa73c]:
{{{
#!CommitTicketReference repository=""
revision="32cfa73c6a7264a0b6365cc380ca0b257b6fc07a"
[4.2.x] Refs #34118 -- Fixed CustomChoicesTests.test_uuid_unsupported on
Python 3.12+.
https://github.com/python/cpython/commit/2a4d8c0a9e88f45047da640ce5a92b304d2d39b1
Backport of 38e63c9e61152682f3ff982c85a73793ab6d3267 from main
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/34118#comment:10>
Comment (by thesamesam):
Hi folks,
https://github.com/django/django/commit/38e63c9e61152682f3ff982c85a73793ab6d3267
was applied to fix Python 3.12, but cpython upstream have backported the
fix for https://github.com/python/cpython/issues/102549 to Python 3.11
too.
--
Ticket URL: <https://code.djangoproject.com/ticket/34118#comment:11>
Comment (by Mariusz Felisiak):
Replying to [comment:11 thesamesam]:
> Hi folks,
>
>
https://github.com/django/django/commit/38e63c9e61152682f3ff982c85a73793ab6d3267
was applied to fix Python 3.12, but cpython upstream have backported the
fix for https://github.com/python/cpython/issues/102549 to Python 3.11
too.
>
> The Django patch will need adjusting to probably just allow both output
messages (or sniff the Python minor/patch version).
Thanks! It's unfortunate, will fix this.
--
Ticket URL: <https://code.djangoproject.com/ticket/34118#comment:12>
* cc: thesamesam (added)
--
Ticket URL: <https://code.djangoproject.com/ticket/34118#comment:13>
Comment (by GitHub <noreply@…>):
In [changeset:"2eb1f37260f0e0b71ef3a77eb5522d2bb68d6489" 2eb1f372]:
{{{
#!CommitTicketReference repository=""
revision="2eb1f37260f0e0b71ef3a77eb5522d2bb68d6489"
Refs #34118 -- Fixed CustomChoicesTests.test_uuid_unsupported on Python
3.11.4+.
https://github.com/python/cpython/commit/5342f5e713e0cc45b6f226d2d053a8cde1b4d68e
Follow up to 38e63c9e61152682f3ff982c85a73793ab6d3267.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/34118#comment:14>
Comment (by Mariusz Felisiak <felisiak.mariusz@…>):
In [changeset:"f6e0029fcd24b476cee703ba69e153ff79b202b9" f6e0029]:
{{{
#!CommitTicketReference repository=""
revision="f6e0029fcd24b476cee703ba69e153ff79b202b9"
[4.2.x] Refs #34118 -- Fixed CustomChoicesTests.test_uuid_unsupported on
Python 3.11.4+.
https://github.com/python/cpython/commit/5342f5e713e0cc45b6f226d2d053a8cde1b4d68e
Follow up to 38e63c9e61152682f3ff982c85a73793ab6d3267.
Backport of 2eb1f37260f0e0b71ef3a77eb5522d2bb68d6489 from main
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/34118#comment:15>
Comment (by Mariusz Felisiak <felisiak.mariusz@…>):
In [changeset:"f55bcff9dcac1d0cb1f927f9fd543cfd567400c4" f55bcff9]:
{{{
#!CommitTicketReference repository=""
revision="f55bcff9dcac1d0cb1f927f9fd543cfd567400c4"
[4.1.x] Refs #34118 -- Fixed CustomChoicesTests.test_uuid_unsupported on
Python 3.11.4+.
https://github.com/python/cpython/commit/5342f5e713e0cc45b6f226d2d053a8cde1b4d68e
Follow up to 38e63c9e61152682f3ff982c85a73793ab6d3267.
Backport of 2eb1f37260f0e0b71ef3a77eb5522d2bb68d6489 from main
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/34118#comment:16>
Comment (by GitHub <noreply@…>):
In [changeset:"5a6d4d3bfde07daab9777545694beb014c832264" 5a6d4d3b]:
{{{
#!CommitTicketReference repository=""
revision="5a6d4d3bfde07daab9777545694beb014c832264"
Refs #34118, Refs #34504 -- Added backward incompatibility note about
EmailBackend.ssl_context.
Follow up to 2848e5d0ce5cf3c31fe87525536093b21d570f69.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/34118#comment:17>
Comment (by Mariusz Felisiak <felisiak.mariusz@…>):
In [changeset:"4f343a10f765c4a6672c8ef4c39d044dd7d6653f" 4f343a1]:
{{{
#!CommitTicketReference repository=""
revision="4f343a10f765c4a6672c8ef4c39d044dd7d6653f"
[4.2.x] Refs #34118, Refs #34504 -- Added backward incompatibility note
about EmailBackend.ssl_context.
Follow up to 2848e5d0ce5cf3c31fe87525536093b21d570f69.
Backport of 5a6d4d3bfde07daab9777545694beb014c832264 from main
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/34118#comment:18>
Comment (by GitHub <noreply@…>):
In [changeset:"fc9c90d9c4611d441d2617a7d74f622b1f520f7c" fc9c90d9]:
{{{
#!CommitTicketReference repository=""
revision="fc9c90d9c4611d441d2617a7d74f622b1f520f7c"
Refs #34118 -- Fixed
FunctionalTests.test_cached_property_reuse_different_names() on Python
3.12+.
Python 3.12+ no longer wraps exceptions in __set_name__, see
https://github.com/python/cpython/commit/55c99d97e14618dfce41472dd4446f763b0da13f
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/34118#comment:19>
Comment (by Mariusz Felisiak <felisiak.mariusz@…>):
In [changeset:"bf5249fc8e0dd6e0c4c3101fda500d6966b6dcfc" bf5249fc]:
{{{
#!CommitTicketReference repository=""
revision="bf5249fc8e0dd6e0c4c3101fda500d6966b6dcfc"
[4.2.x] Refs #34118 -- Fixed
FunctionalTests.test_cached_property_reuse_different_names() on Python
3.12+.
Python 3.12+ no longer wraps exceptions in __set_name__, see
https://github.com/python/cpython/commit/55c99d97e14618dfce41472dd4446f763b0da13f
Backport of fc9c90d9c4611d441d2617a7d74f622b1f520f7c from main
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/34118#comment:20>
Comment (by GitHub <noreply@…>):
In [changeset:"da2f8e8257d1bea4215381684ca4abfcee333c43" da2f8e8]:
{{{
#!CommitTicketReference repository=""
revision="da2f8e8257d1bea4215381684ca4abfcee333c43"
Refs #34118 -- Improved sanitize_address() error message for tuple with
empty strings.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/34118#comment:21>
Comment (by GitHub <noreply@…>):
In [changeset:"62b83889e066b8270854f7560e0498944efd7689" 62b83889]:
{{{
#!CommitTicketReference repository=""
revision="62b83889e066b8270854f7560e0498944efd7689"
Fixed #34731, Refs #34118 -- Replaced assertEquals() with assertEqual() in
test_condition_with_func_and_lookup_outside_relation_name().
Signed-off-by: Michel Alexandre Salim <sal...@fedoraproject.org>
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/34118#comment:22>
* owner: nobody => Mariusz Felisiak
* status: new => assigned
* stage: Someday/Maybe => Accepted
Comment:
https://www.python.org/downloads/release/python-3120/
--
Ticket URL: <https://code.djangoproject.com/ticket/34118#comment:23>
Comment (by GitHub <noreply@…>):
In [changeset:"20b7aac7ca60b0352d926340622e618bcbee54a8" 20b7aac7]:
{{{
#!CommitTicketReference repository=""
revision="20b7aac7ca60b0352d926340622e618bcbee54a8"
Refs #34900, Refs #34118 -- Updated assertion in
test_skip_class_unless_db_feature() test on Python 3.12.1+.
Python 3.12.1+ no longer includes skipped tests in the number of
running tests. Check out:
https://github.com/python/cpython/issues/110890#issuecomment-1763458686
https://github.com/python/cpython/pull/106588
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/34118#comment:24>
Comment (by Mariusz Felisiak <felisiak.mariusz@…>):
In [changeset:"448510a94b9af30e1d9384166f830e8da2ef0438" 448510a9]:
{{{
#!CommitTicketReference repository=""
revision="448510a94b9af30e1d9384166f830e8da2ef0438"
[5.0.x] Refs #34900, Refs #34118 -- Updated assertion in
test_skip_class_unless_db_feature() test on Python 3.12.1+.
Python 3.12.1+ no longer includes skipped tests in the number of
running tests. Check out:
https://github.com/python/cpython/issues/110890#issuecomment-1763458686
https://github.com/python/cpython/pull/106588
Backport of 20b7aac7ca60b0352d926340622e618bcbee54a8 from main
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/34118#comment:25>
Comment (by Mariusz Felisiak <felisiak.mariusz@…>):
In [changeset:"a576ef98aea2709741f32a863cff3c7a54172ded" a576ef9]:
{{{
#!CommitTicketReference repository=""
revision="a576ef98aea2709741f32a863cff3c7a54172ded"
[4.2.x] Refs #34900, Refs #34118 -- Updated assertion in
test_skip_class_unless_db_feature() test on Python 3.12.1+.
Python 3.12.1+ no longer includes skipped tests in the number of
running tests. Check out:
https://github.com/python/cpython/issues/110890#issuecomment-1763458686
https://github.com/python/cpython/pull/106588
Backport of 20b7aac7ca60b0352d926340622e618bcbee54a8 from main
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/34118#comment:26>
Comment (by Mariusz Felisiak <felisiak.mariusz@…>):
In [changeset:"e2922b0d5f18169d1d0115a6db5d2ed8c42d0692" e2922b0]:
{{{
#!CommitTicketReference repository=""
revision="e2922b0d5f18169d1d0115a6db5d2ed8c42d0692"
Refs #34118 -- Avoided repeat coroutine checks in MiddlewareMixin.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/34118#comment:27>
Comment (by GitHub <noreply@…>):
In [changeset:"19c4052f98e5dc4fe9d7edd7125df6a66efbd79f" 19c4052f]:
{{{
#!CommitTicketReference repository=""
revision="19c4052f98e5dc4fe9d7edd7125df6a66efbd79f"
Refs #34118 -- Used Python 3.12 for GitHub actions.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/34118#comment:28>
* has_patch: 0 => 1
Comment:
[https://github.com/django/django/pull/17488 PR]
--
Ticket URL: <https://code.djangoproject.com/ticket/34118#comment:29>
Comment (by GitHub <noreply@…>):
In [changeset:"b5750b9f6414865200221d9c0dc568ae6b551294" b5750b9f]:
{{{
#!CommitTicketReference repository=""
revision="b5750b9f6414865200221d9c0dc568ae6b551294"
[4.2.x] Refs #34118 -- Fixed stacklevel in complex_setting_changed on
Python 3.12.
This fix is unnecessary in Django 5.0 since
e83a88566a71a2353cebc35992c110be0f8628af because signals no longer use
sync_to_async().
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/34118#comment:30>
Comment (by Mariusz Felisiak <felisiak.mariusz@…>):
In [changeset:"f955c90488e1f32e6e38b3c956e937579d389fb2" f955c90]:
{{{
#!CommitTicketReference repository=""
revision="f955c90488e1f32e6e38b3c956e937579d389fb2"
Refs #34118 -- Added Python 3.12 to classifiers and tox.ini.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/34118#comment:31>
Comment (by Mariusz Felisiak <felisiak.mariusz@…>):
In [changeset:"ecfea054ee2b8ddfa027459ff8b6aecba05facf7" ecfea05]:
{{{
#!CommitTicketReference repository=""
revision="ecfea054ee2b8ddfa027459ff8b6aecba05facf7"
Refs #34118 -- Doc'd Python 3.12 compatibility in Django 4.2.x.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/34118#comment:32>
Comment (by Mariusz Felisiak <felisiak.mariusz@…>):
In [changeset:"f721fb937c6e41fab3cc1451f7170e8d9ab4940d" f721fb93]:
{{{
#!CommitTicketReference repository=""
revision="f721fb937c6e41fab3cc1451f7170e8d9ab4940d"
[5.0.x] Refs #34118 -- Doc'd Python 3.12 compatibility in Django 4.2.x.
Backport of ecfea054ee2b8ddfa027459ff8b6aecba05facf7 from main
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/34118#comment:34>
Comment (by Mariusz Felisiak <felisiak.mariusz@…>):
In [changeset:"c342b58243fac5019290bb328d68093462066535" c342b58]:
{{{
#!CommitTicketReference repository=""
revision="c342b58243fac5019290bb328d68093462066535"
[5.0.x] Refs #34118 -- Added Python 3.12 to classifiers and tox.ini.
Backport of f955c90488e1f32e6e38b3c956e937579d389fb2 from main
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/34118#comment:33>
Comment (by Mariusz Felisiak <felisiak.mariusz@…>):
In [changeset:"233e2a9e31ba7acbad4a0f5131ed2bcdcdba3b02" 233e2a9e]:
{{{
#!CommitTicketReference repository=""
revision="233e2a9e31ba7acbad4a0f5131ed2bcdcdba3b02"
[4.2.x] Refs #34118 -- Added Python 3.12 to classifiers and tox.ini.
Backport of f955c90488e1f32e6e38b3c956e937579d389fb2 from main.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/34118#comment:35>
Comment (by Mariusz Felisiak <felisiak.mariusz@…>):
In [changeset:"9afeb6b9b6d4e025306c918e7e717288049cbdfd" 9afeb6b9]:
{{{
#!CommitTicketReference repository=""
revision="9afeb6b9b6d4e025306c918e7e717288049cbdfd"
[4.2.x] Refs #34118 -- Doc'd Python 3.12 compatibility in Django 4.2.x.
Backport of ecfea054ee2b8ddfa027459ff8b6aecba05facf7 from main.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/34118#comment:36>
* status: assigned => closed
* resolution: => fixed
--
Ticket URL: <https://code.djangoproject.com/ticket/34118#comment:37>
In [changeset:"bc8471f0aac8f0c215b9471b594d159783bac19b" bc8471f0]:
{{{#!CommitTicketReference repository=""
revision="bc8471f0aac8f0c215b9471b594d159783bac19b"
Refs #34900, Refs #34118 -- Updated assertion in
test_skip_class_unless_db_feature() test on Python 3.12.2+.
Python 3.12.2 bring back the skipped tests in the number of running
tests. Refs
https://github.com/python/cpython/commit/0a737639dcd3b7181250f5d56694b192eaddeef0
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/34118#comment:38>
In [changeset:"1ba5afa0f21f10843bb530b443687e07a511516a" 1ba5afa]:
{{{#!CommitTicketReference repository=""
revision="1ba5afa0f21f10843bb530b443687e07a511516a"
[5.0.x] Refs #34900, Refs #34118 -- Updated assertion in
test_skip_class_unless_db_feature() test on Python 3.12.2+.
Python 3.12.2 bring back the skipped tests in the number of running
tests. Refs
https://github.com/python/cpython/commit/0a737639dcd3b7181250f5d56694b192eaddeef0
Backport of bc8471f0aac8f0c215b9471b594d159783bac19b from main
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/34118#comment:39>
In [changeset:"86d8034972db5014769cdd4832125067f31b3e8b" 86d8034]:
{{{#!CommitTicketReference repository=""
revision="86d8034972db5014769cdd4832125067f31b3e8b"
[4.2.x] Refs #34900, Refs #34118 -- Updated assertion in
test_skip_class_unless_db_feature() test on Python 3.12.2+.
Python 3.12.2 bring back the skipped tests in the number of running
tests. Refs
https://github.com/python/cpython/commit/0a737639dcd3b7181250f5d56694b192eaddeef0
Backport of bc8471f0aac8f0c215b9471b594d159783bac19b from main
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/34118#comment:40>