#34118 closed New feature (fixed)
Python 3.12 compatibility
| Reported by: | Mariusz Felisiak | Owned by: | Mariusz Felisiak |
|---|---|---|---|
| Component: | Core (Other) | Version: | dev |
| Severity: | Normal | Keywords: | |
| Cc: | bcail, David Sanders, Sam James | Triage Stage: | Accepted |
| Has patch: | yes | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
Python 3.12 final is scheduled for October 2023 (see PEP 693). This is a tracking ticket for compatibility fixes for Django submitted in the meantime.
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.
Change History (42)
comment:1 by , 3 years ago
| Cc: | added |
|---|
comment:2 by , 3 years ago
| Cc: | added |
|---|
comment:4 by , 3 years ago
Another data point: SQLite and Postgres tests pass for me on Linux with Python 3.12 alpha 1.
follow-up: 12 comment:11 by , 3 years ago
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).
comment:12 by , 3 years ago
Replying to 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.
comment:13 by , 3 years ago
| Cc: | added |
|---|
comment:23 by , 2 years ago
| Owner: | changed from to |
|---|---|
| Status: | new → assigned |
| Triage Stage: | Someday/Maybe → Accepted |
comment:37 by , 2 years ago
| Resolution: | → fixed |
|---|---|
| Status: | assigned → closed |
I'm getting errors on the following which was working for 3.11.0.
I'm on macos 12.6
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'...