diff --git a/Makefile b/Makefile
index c6a5ecc96bb9429dbc7f1cf940bbc03f7eab8039..be611384000fa1ced06701b4f74c290682ce202f 100644
--- a/Makefile
+++ b/Makefile
@@ -37,14 +37,21 @@ tests:
 	nosetests3 --with-doctest --with-coverage
 
 check_versions:
-	@PYTHONPATH=. set -e; \
-	DEFAULT=`python3 -c 'import debpython.version as v; print(v.vrepr(v.DEFAULT))'`;\
-	SUPPORTED=`python3 -c 'import debpython.version as v; print(" ".join(sorted(v.vrepr(v.SUPPORTED))))'`;\
+	@PYTHONPATH=. set -ex; \
 	DEB_DEFAULT=`sed -rn 's,^default-version = python([0.9.]*),\1,p' debian/debian_defaults`;\
 	DEB_SUPPORTED=`sed -rn 's|^supported-versions = (.*)|\1|p' debian/debian_defaults | sed 's/python//g;s/,//g'`;\
+	DEFAULT=`python$$DEB_DEFAULT -c 'import debpython.version as v; print(v.vrepr(v.DEFAULT))'`;\
+	SUPPORTED=`python$$DEB_DEFAULT -c 'import debpython.version as v; print(" ".join(sorted(v.vrepr(v.SUPPORTED))))'`;\
+	MIN_SUPPORTED=$${SUPPORTED%% *};\
+	MAX_SUPPORTED=$${SUPPORTED##* };\
 	[ "$$DEFAULT" = "$$DEB_DEFAULT" ] || \
 	(echo 'Please update DEFAULT in debpython/version.py' >/dev/stderr; false);\
 	[ "$$SUPPORTED" = "$$DEB_SUPPORTED" ] || \
-	(echo 'Please update SUPPORTED in debpython/version.py' >/dev/stderr; false)
+	(echo 'Please update SUPPORTED in debpython/version.py' >/dev/stderr; false);\
+	grep -Fq "python3-supported-min (= $$MIN_SUPPORTED)" debian/control || \
+	(echo 'Please update python3-supported-min in debian/control.in' >/dev/stderr; false);\
+	grep -Fq "python3-supported-max (= $$MAX_SUPPORTED)" debian/control || \
+	(echo 'Please update python3-supported-max in debian/control.in' >/dev/stderr; false)
+
 
 .PHONY: clean tests test% check_versions
diff --git a/debian/apertis/copyright b/debian/apertis/copyright
index f81e94301480f6974afc97e0164595eadd2f271a..9cea9a698df0218d4ed109d7da72fe252b65beae 100644
--- a/debian/apertis/copyright
+++ b/debian/apertis/copyright
@@ -12,18 +12,30 @@ Files: debpython/*
 Copyright: 2010-2012, Piotr Ożarowski <piotr@debian.org>
 License: Expat
 
-Files: debpython/__init__.py
-Copyright: no-info-found
-License: Expat
-
 Files: faq/general.ht
 Copyright: restrictions on the use of Python?
 License: Expat
 
-Files: policy/copyright.rst
+Files: policy/*
 Copyright: no-info-found
 License: GPL-2+
 
+Files: policy/Makefile
+ policy/build-dependencies.rst
+ policy/conf.py
+ policy/embedded-python.rst
+ policy/interpreter.rst
+ policy/locally-installed-python.rst
+ policy/make.bat
+ policy/packaged-modules.rst
+ policy/packaging-tools.rst
+ policy/python-programs.rst
+ policy/python3.rst
+ policy/this-document.rst
+ policy/upgrade-procedure.rst
+Copyright: no-info-found
+License: Expat
+
 Files: policy/index.rst
 Copyright: python3
 License: Expat
@@ -36,4 +48,3 @@ Files: py3compile
 Copyright: 2010-2012, Piotr Ożarowski <piotr@debian.org>
  2010, Canonical Ltd
 License: Expat
-
diff --git a/debian/changelog b/debian/changelog
index aa6638424e033ae89e5bbff80005df56c4acb0b7..f3ad67c129d2828db8950acafea35f331243de25 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,120 @@
+python3-defaults (3.12.8-1+apertis0) apertis; urgency=medium
+
+  * Sync from debian/trixie.
+
+ -- Apertis CI <devel@lists.apertis.org>  Thu, 09 Jan 2025 10:56:33 +0000
+
+python3-defaults (3.12.8-1) unstable; urgency=medium
+
+  * Bump version to 3.12.8
+  * Update python3-supported-max (missed in 3.12.7-1).
+  * Add a check that python3-supported-(min|max) is correct.
+  * Re-enable check_versions at build time.
+
+ -- Stefano Rivera <stefanor@debian.org>  Mon, 23 Dec 2024 15:15:27 -0400
+
+python3-defaults (3.12.7-1) unstable; urgency=medium
+
+  [ Matthias Klose ]
+  * Bump version to 3.12.7
+
+  [ Stefano Rivera ]
+  * Add 3.13 as a supported Python3 version.
+
+ -- Matthias Klose <doko@debian.org>  Wed, 13 Nov 2024 06:53:11 +0100
+
+python3-defaults (3.12.6-1) unstable; urgency=medium
+
+  * Bump version to 3.12.6
+  * 2to3: Remove obsolete breaks/replaces.
+  * Make python3 maintainer scripts more robust for runtime updates.
+    LP: #2078356.
+
+ -- Matthias Klose <doko@debian.org>  Mon, 16 Sep 2024 17:21:13 +0200
+
+python3-defaults (3.12.5-1) unstable; urgency=medium
+
+  * Bump version to 3.12.5
+  * debpython/files.py: Set LC_ALL="C.UTF-8" before calling dpkg -L to avoid
+    localization issues (LP: #2075337)
+  * Bump standards version.
+
+ -- Matthias Klose <doko@debian.org>  Thu, 08 Aug 2024 07:30:33 +0200
+
+python3-defaults (3.12.4-1) unstable; urgency=medium
+
+  * Bump version to 3.12.4
+  * python3: Conflict with python3-distutils.
+
+ -- Matthias Klose <doko@debian.org>  Sat, 20 Jul 2024 11:46:46 +0200
+
+python3-defaults (3.12.3-1) unstable; urgency=medium
+
+  * Bump version to 3.12.3
+  * Drop dependencies on python3-distutils.
+  * Remove Python 3.11 as a supported version.
+
+ -- Matthias Klose <doko@debian.org>  Tue, 09 Jul 2024 13:01:35 +0200
+
+python3-defaults (3.12.2-1) unstable; urgency=medium
+
+  [ Stefano Rivera ]
+  * Migrate to html2text 2.x, which dropped the -pretty flag.
+    Closes: #1064737.
+  * Fix typo in py3clean manpage. Thanks JT Hundley. Closes: #1070728.
+
+  [ Matthias Klose ]
+  * Bump version.
+  * Depend on libpython3.XYt64-dbg, tighten python3.12 build dependency.
+
+ -- Matthias Klose <doko@debian.org>  Mon, 24 Jun 2024 10:23:35 +0200
+
+python3-defaults (3.12.1-1) experimental; urgency=medium
+
+  * Default to Python 3.12.
+  * Bump hardcoded Provides: python3-supported-max to 3.12.
+  * Stop building the transitional idle3 package. Closes: #1032789.
+
+ -- Matthias Klose <doko@debian.org>  Sat, 20 Jan 2024 09:02:48 +0100
+
+python3-defaults (3.11.6-1) unstable; urgency=medium
+
+  * Add 3.12 as a supported Python3 version.
+  * Bump version to 3.11.6.
+
+ -- Matthias Klose <doko@debian.org>  Sun, 03 Dec 2023 10:21:41 +0100
+
+python3-defaults (3.11.4-5) unstable; urgency=medium
+
+  * Source-only upload.
+
+ -- Piotr Ożarowski <piotr@debian.org>  Wed, 05 Jul 2023 11:27:27 +0200
+
+python3-defaults (3.11.4-4) unstable; urgency=high
+
+  * Fix importlib.util import (-3 regression, closes: 1040316)
+
+ -- Piotr Ożarowski <piotr@debian.org>  Tue, 04 Jul 2023 19:49:27 +0200
+
+python3-defaults (3.11.4-3) unstable; urgency=medium
+
+  * debpython/interpreter.py: Stop using the imp module, removed in 3.12.
+    Closes: #1040261.
+
+ -- Matthias Klose <doko@debian.org>  Tue, 04 Jul 2023 12:08:14 +0200
+
+python3-defaults (3.11.4-2) experimental; urgency=medium
+
+  * Add new binary package: python3-all-venv. Closes: #1039988.
+
+ -- Stefano Rivera <stefanor@debian.org>  Sat, 01 Jul 2023 09:38:35 -0400
+
+python3-defaults (3.11.4-1) unstable; urgency=medium
+
+  * Bump version to 3.11.4.
+
+ -- Matthias Klose <doko@debian.org>  Sun, 25 Jun 2023 14:41:31 +0200
+
 python3-defaults (3.11.2-1+apertis1) apertis; urgency=medium
 
   * No changes.
diff --git a/debian/control b/debian/control
index 82521154cc176c90ba7f16c033bc8ae99554805e..bbec710458b39cbc49ad402c189111d1ea6fdea5 100644
--- a/debian/control
+++ b/debian/control
@@ -3,12 +3,12 @@ Section: python
 Priority: optional
 Maintainer: Matthias Klose <doko@debian.org>
 Uploaders: Piotr Ożarowski <piotr@debian.org>, Stefano Rivera <stefanor@debian.org>
-Build-Depends: debhelper (>= 11), dpkg-dev (>= 1.17.11), python3.11:any (>= 3.11.2-1~),
-  python3.11-minimal:any,
+Build-Depends: debhelper (>= 11), dpkg-dev (>= 1.17.11), python3.12:any (>= 3.12.7-1~),
+  python3.12-minimal:any,
   python3-docutils <!nodoc>,
   python3-sphinx <!nodoc>,
-  html2text <!nodoc>,
-Standards-Version: 4.6.2
+  html2text (>= 2) <!nodoc>,
+Standards-Version: 4.7.0
 Homepage: https://www.python.org/
 Vcs-Git: https://salsa.debian.org/cpython-team/python3-defaults.git
 Vcs-Browser: https://salsa.debian.org/cpython-team/python3-defaults
@@ -17,23 +17,24 @@ Package: python3
 Architecture: any
 Multi-Arch: allowed
 Pre-Depends: python3-minimal (= ${binary:Version})
-Depends: python3.11 (>= 3.11.2-1~), libpython3-stdlib (= ${binary:Version}), ${misc:Depends}
-Suggests: python3-doc (>= ${binary:Version}), python3-tk (>= 3.11.2-1~) , python3-venv (>= ${binary:Version})
+Depends: python3.12 (>= 3.12.7-1~), libpython3-stdlib (= ${binary:Version}), ${misc:Depends}
+Suggests: python3-doc (>= ${binary:Version}), python3-tk (>= 3.12.7-1~) , python3-venv (>= ${binary:Version})
 Replaces: python3-minimal (<< 3.1.2-2)
-Provides: python3-profiler, python3-supported-min (= 3.11), python3-supported-max (= 3.11)
+Provides: python3-profiler, python3-supported-min (= 3.12), python3-supported-max (= 3.13)
+Conflicts: python3-distutils
 Description: interactive high-level object-oriented language (default python3 version)
  Python, the high-level, interactive object oriented language,
  includes an extensive class library with lots of goodies for
  network programming, system administration, sounds and graphics.
  .
  This package is a dependency package, which depends on Debian's default
- Python 3 version (currently v3.11).
+ Python 3 version (currently v3.12).
 
 Package: python3-venv
 Architecture: any
 Multi-Arch: allowed
-Depends: python3.11-venv (>= 3.11.2-1~), python3 (= ${binary:Version}),
-  python3-distutils (>= 3.11.2-1~), ${misc:Depends}
+Depends: python3.12-venv (>= 3.12.7-1~), python3 (= ${binary:Version}),
+  ${misc:Depends}
 Description: venv module for python3 (default python3 version)
  This package contains the venv module for the Python language (default python3
  version).
@@ -46,17 +47,17 @@ Description: venv module for python3 (default python3 version)
  directories.
  .
  This package is a dependency package, which depends on Debian's default
- Python 3 version's venv module (currently v3.11).
+ Python 3 version's venv module (currently v3.12).
 
 Package: python3-minimal
 Architecture: any
 Multi-Arch: allowed
-Pre-Depends: python3.11-minimal (>= 3.11.2-1~)
+Pre-Depends: python3.12-minimal (>= 3.12.7-1~)
 Depends: dpkg (>= 1.13.20), ${misc:Depends}
 Description: minimal subset of the Python language (default python3 version)
  This package contains the interpreter and some essential modules.  It's used
  in the boot process for some basic tasks.
- See /usr/share/doc/python3.11-minimal/README.Debian for a list of the modules
+ See /usr/share/doc/python3.12-minimal/README.Debian for a list of the modules
  contained in this package.
 XB-Cnf-Visible-Pkgname: python3
 
@@ -64,7 +65,7 @@ Package: python3-nopie
 Architecture: any
 Multi-Arch: allowed
 Depends: python3 (= ${binary:Version}),
-  python3.11-nopie (>= 3.11.2-1~), ${misc:Depends}
+  python3.12-nopie (>= 3.12.7-1~), ${misc:Depends}
 Description: Python interpreter linked without PIE (default python3 version)
  This package contains the interpreter not built as position independent
  executable. This interpreter is diverting the python3 executable, and making
@@ -74,19 +75,19 @@ XB-Cnf-Visible-Pkgname: python3
 Package: python3-examples
 Architecture: all
 Multi-Arch: foreign
-Depends: python3 (>= ${binary:Version}), python3.11-examples (>= 3.11.2-1~), ${misc:Depends}
+Depends: python3 (>= ${binary:Version}), python3.12-examples (>= 3.12.7-1~), ${misc:Depends}
 Description: examples for the Python language (default version)
  Examples, Demos and Tools for Python. These are files included in
  the upstream Python distribution.
  .
  This package is a dependency package, which depends on Debian's default
- Python 3 version's examples (currently v3.11).
+ Python 3 version's examples (currently v3.12).
 
 Package: python3-dev
 Architecture: any
 Multi-Arch: allowed
 Depends: python3 (= ${binary:Version}), libpython3-dev (= ${binary:Version}),
-  python3.11-dev (>= 3.11.2-1~), python3-distutils (>= 3.11.2-1~),
+  python3.12-dev (>= 3.12.7-1~),
   ${misc:Depends}, ${sphinxdoc:Depends}
 Breaks: python3 (<< 3.9.2-1~)
 Replaces: python3.1 (<< 3.1.2+20100706-3), python3 (<< 3.9.2-1~)
@@ -97,13 +98,13 @@ Description: header files and a static library for Python (default)
  in applications.
  .
  This package is a dependency package, which depends on Debian's default
- Python 3 version's headers (currently v3.11).
+ Python 3 version's headers (currently v3.12).
 
 Package: libpython3-dev
 Architecture: any
 Multi-Arch: same
 Section: libdevel
-Depends: libpython3.11-dev (>= 3.11.2-1~), ${misc:Depends}
+Depends: libpython3.12-dev (>= 3.12.7-1~), ${misc:Depends}
 Breaks: libpython3.8-dev (<< 3.8.0-2), python3-dev (<< 3.8.0-1)
 Replaces: libpython3.8-dev (<< 3.8.0-2), python3-dev (<< 3.8.0-1)
 Description: header files and a static library for Python (default)
@@ -112,22 +113,22 @@ Description: header files and a static library for Python (default)
  in applications.
  .
  This package is a dependency package, which depends on Debian's default
- Python 3 version's headers (currently v3.11).
+ Python 3 version's headers (currently v3.12).
 
 Package: libpython3-stdlib
 Architecture: any
 Multi-Arch: same
-Depends: libpython3.11-stdlib (>= 3.11.2-1~), ${misc:Depends}
+Depends: libpython3.12-stdlib (>= 3.12.7-1~), ${misc:Depends}
 Description: interactive high-level object-oriented language (default python3 version)
  This package contains the majority of the standard library for the Python
  language (default python3 version).
  .
  This package is a dependency package, which depends on Debian's default
- Python 3 version's standard library (currently v3.11).
+ Python 3 version's standard library (currently v3.12).
 
 Package: idle
 Architecture: all
-Depends: python3 (>= ${binary:Version}), python3-tk, ${misc:Depends}, idle-python3.11
+Depends: python3 (>= ${binary:Version}), python3-tk, ${misc:Depends}, idle-python3.12
 Enhances: python3
 Breaks: idle3 (<< 3.6.2-2)
 Replaces: idle3 (<< 3.6.2-2)
@@ -136,26 +137,17 @@ Description: IDE for Python using Tkinter (default version)
  IDLE is written using Tkinter and therefore quite platform-independent.
  .
  This package is a dependency package, which depends on Debian's default
- Python 3 version's IDLE (currently v3.11).
-
-Package: idle3
-Architecture: all
-Section: oldlibs
-Depends: python3 (>= ${binary:Version}), idle (>= ${binary:Version}), ${misc:Depends}
-Description: IDE for Python using Tkinter (transitional package)
- IDLE is an Integrated Development Environment for Python.
- .
- This package is a transitional package, you can safely remove it.
+ Python 3 version's IDLE (currently v3.12).
 
 Package: python3-doc
 Section: doc
 Architecture: all
 Multi-Arch: foreign
-Depends: python3.11-doc (>= 3.11.2-1~), ${misc:Depends}
+Depends: python3.12-doc (>= 3.12.7-1~), ${misc:Depends}
 Suggests: python3 (>= ${binary:Version}), python3-examples
 Description: documentation for the high-level object-oriented language Python 3
  This is the official set of documentation for the interactive high-level
- object-oriented language Python 3 (v3.11). All documents are provided
+ object-oriented language Python 3 (v3.12). All documents are provided
  in HTML format, some in info format. The package consists of nine documents:
  .
    * Tutorial
@@ -169,38 +161,39 @@ Description: documentation for the high-level object-oriented language Python 3
    * Distributing Python Modules
  .
  This package is a dependency package, which depends on Debian's default
- Python 3 version's documentation (currently v3.11).
+ Python 3 version's documentation (currently v3.12).
 
 Package: python3-dbg
 Architecture: any
 Multi-Arch: allowed
 Section: debug
-Depends: python3 (= ${binary:Version}), libpython3-dbg (= ${binary:Version}), python3.11-dbg (>= 3.11.2-1~), ${misc:Depends}
-Description: debug build of the Python 3 Interpreter (version 3.11)
+Depends: python3 (= ${binary:Version}), libpython3-dbg (= ${binary:Version}), python3.12-dbg (>= 3.12.7-1~), ${misc:Depends}
+Description: debug build of the Python 3 Interpreter (version 3.12)
  Python 3 interpreter configured with --pydebug. Dynamically loaded modules
- are searched in /usr/lib/python3.11/lib-dynload/debug first.
+ are searched in /usr/lib/python3.12/lib-dynload/debug first.
 
 Package: libpython3-dbg
 Architecture: any
 Multi-Arch: same
 Section: debug
-Depends: libpython3.11-dbg (>= 3.11.2-1~), ${misc:Depends}
+Depends: libpython3.12t64-dbg (>= 3.12.7-1~), ${misc:Depends}
 Breaks: python3-dbg (<< 3.8.0-1)
 Replaces: python3-dbg (<< 3.8.0-1)
-Description: debug build of the Python 3 Interpreter (version 3.11)
+Description: debug build of the Python 3 Interpreter (version 3.12)
  Python 3 interpreter configured with --pydebug. Dynamically loaded modules
- are searched in /usr/lib/python3.11/lib-dynload/debug first.
+ are searched in /usr/lib/python3.12/lib-dynload/debug first.
 
 Package: python3-all
 Architecture: any
 Multi-Arch: allowed
 Depends: python3 (= ${binary:Version}),
  ${misc:Depends},
- python3-distutils (>= 3.11.2-1~),
- python3.11,
+ python3.12,
+ python3.13,
 Description: package depending on all supported Python 3 runtime versions
- The package currently depends on python3.11, in the future, dependencies on
- jython (Python for a JVM) and ironpython (Python for Mono) may be added.
+ The package currently depends on python3.12 and python3.13. In the future,
+ dependencies on jython (Python for a JVM) and ironpython (Python for Mono) may
+ be added.
  .
  This package is a dependency package used as a build dependency for other
  packages to avoid hardcoded dependencies on specific Python 3 runtimes.
@@ -213,10 +206,12 @@ Depends: python3 (= ${binary:Version}),
  python3-all (= ${binary:Version}),
  python3-dev (= ${binary:Version}),
  ${misc:Depends},
- python3.11-dev,
+ python3.12-dev,
+ python3.13-dev,
 Description: package depending on all supported Python 3 development packages
- The package currently depends on python3.11-dev, in the future, dependencies
- on jython (Python for a JVM) and ironpython (Python for Mono) may be added.
+ The package currently depends on python3.12-dev and python3.13-dev. In the
+ future, dependencies on jython (Python for a JVM) and ironpython (Python for
+ Mono) may be added.
  .
  This package is a dependency package used as a build dependency for other
  packages to avoid hardcoded dependencies on specific Python 3 development
@@ -231,25 +226,45 @@ Depends: python3 (= ${binary:Version}),
  python3-all (= ${binary:Version}),
  python3-dbg (= ${binary:Version}),
  ${misc:Depends},
- python3.11-dbg,
+ python3.12-dbg,
+ python3.13-dbg,
 Description: package depending on all supported Python 3 debugging packages
- The package currently depends on python3.11-dbg, in the future, dependencies
- on jython (Python for a JVM) and ironpython (Python for Mono) may be added.
+ The package currently depends on python3.12-dbg and python3.13-dbg. In the
+ future, dependencies on jython (Python for a JVM) and ironpython (Python for
+ Mono) may be added.
  .
  This package is a dependency package used as a build dependency for other
  packages to avoid hardcoded dependencies on specific Python 3 debug packages.
 
+Package: python3-all-venv
+Architecture: any
+Multi-Arch: allowed
+Depends: python3 (= ${binary:Version}),
+ python3-all (= ${binary:Version}),
+ python3-venv (= ${binary:Version}),
+ ${misc:Depends},
+ python3.12-venv,
+ python3.13-venv,
+Description: package depending on all supported Python 3 venv modules
+ The package currently depends on python3.12-venv and python3.13-venv. In the
+ future, dependencies on jython (Python for a JVM) and ironpython (Python for
+ Mono) may be added.
+ .
+ This package is a dependency package used as a build dependency for other
+ packages to avoid hardcoded dependencies on specific Python 3 venv packages.
+
 Package: libpython3-all-dev
 Architecture: any
 Multi-Arch: same
 Section: libdevel
 Depends: libpython3-dev (= ${binary:Version}),
  ${misc:Depends},
- libpython3.11-dev,
+ libpython3.12-dev,
+ libpython3.13-dev,
 Description: package depending on all supported Python 3 development packages
- The package currently depends on libpython3.11-dev, in the future,
- dependencies on jython (Python for a JVM) and ironpython (Python for Mono) may
- be added.
+ The package currently depends on libpython3.12-dev and libpython3.13-dev. In
+ the future, dependencies on jython (Python for a JVM) and ironpython (Python
+ for Mono) may be added.
  .
  This package is a dependency package used as a build dependency for other
  packages to avoid hardcoded dependencies on specific Python 3 development
@@ -261,11 +276,12 @@ Multi-Arch: same
 Section: debug
 Depends: libpython3-dbg (= ${binary:Version}),
  ${misc:Depends},
- libpython3.11-dbg,
+ libpython3.12t64-dbg,
+ libpython3.13-dbg,
 Description: package depending on all supported Python 3 debugging packages
- The package currently depends on libpython3.11-dbg, in the future,
- dependencies on jython (Python for a JVM) and ironpython (Python for Mono) may
- be added.
+ The package currently depends on libpython3.12-dbg and libpython3.13-dbg. In
+ the future, dependencies on jython (Python for a JVM) and ironpython (Python
+ for Mono) may be added.
  .
  This package is a dependency package used as a build dependency for other
  packages to avoid hardcoded dependencies on specific Python 3 debug packages.
@@ -273,9 +289,7 @@ Description: package depending on all supported Python 3 debugging packages
 Package: 2to3
 Architecture: all
 Multi-Arch: foreign
-Depends: python3-lib2to3 (>= 3.11.2-1~), python3 (>= ${binary:Version}), ${misc:Depends}
-Breaks: python (<< 2.7.14-4)
-Replaces: python (<< 2.7.14-4)
+Depends: python3-lib2to3 (>= 3.12.7-1~), python3 (>= ${binary:Version}), ${misc:Depends}
 Description: 2to3 binary using python3
  2to3 is a Python program that reads Python 2.x source code and applies a
  series of fixers to transform it into valid Python 3.x code. The standard
@@ -285,17 +299,16 @@ Description: 2to3 binary using python3
  to custom applications in which Python code needs to be edited automatically.
  .
  This package is a dependency package, which depends on Debian's default
- Python 3 2to3 version (currently v3.11).
+ Python 3 2to3 version (currently v3.12).
 
 Package: python3-full
 Architecture: any
 Multi-Arch: allowed
 Depends: python3 (= ${binary:Version}),
-  python3.11-full (>= 3.11.2-1~),
+  python3.12-full (>= 3.12.7-1~),
   python3-venv (= ${binary:Version}),
   2to3,
   idle,
-  python3-distutils,
   python3-gdbm,
   python3-lib2to3,
   python3-tk,
@@ -309,11 +322,11 @@ Description: Default Python Interpreter with complete class library
  .
  This package is a dependency package, which depends on the full
  standard library of Python for Python developers. Including modules
- used only at build-time, such as venv and distutils, and modules with
+ used only at build-time, such as venv, and modules with
  complex dependencies, such as tk and IDLE. All batteries included.
  .
  This package depends on Debian's default python 3 version's full
- standard library (currently v3.11).
+ standard library (currently v3.12).
  .
  According to the Debian Python policy, this package must not be used in
  build dependencies, dependencies and recommendations.
diff --git a/debian/control.in b/debian/control.in
index 1d803c75ec58892a70dcd699924126c56e6d1ced..33bd30296415bb0440b8ea83f31d9e451d6bc4a9 100644
--- a/debian/control.in
+++ b/debian/control.in
@@ -7,8 +7,8 @@ Build-Depends: debhelper (>= 11), @bd_i586@
   python@VER@-minimal:any,
   python3-docutils <!nodoc>,
   python3-sphinx <!nodoc>,
-  html2text <!nodoc>,
-Standards-Version: 4.6.2
+  html2text (>= 2) <!nodoc>,
+Standards-Version: 4.7.0
 Homepage: https://www.python.org/
 Vcs-Git: https://salsa.debian.org/cpython-team/python3-defaults.git
 Vcs-Browser: https://salsa.debian.org/cpython-team/python3-defaults
@@ -20,7 +20,8 @@ Pre-Depends: python3-minimal (= ${binary:Version})
 Depends: python@VER@ (>= @UPSTRVER@), libpython3-stdlib (= ${binary:Version}), ${misc:Depends}
 Suggests: python3-doc (>= ${binary:Version}), python3-tk (>= @STDLIBVER@) , python3-venv (>= ${binary:Version})
 Replaces: python3-minimal (<< 3.1.2-2)
-Provides: python3-profiler, python3-supported-min (= 3.11), python3-supported-max (= 3.11)
+Provides: python3-profiler, python3-supported-min (= 3.12), python3-supported-max (= 3.13)
+Conflicts: python3-distutils
 Description: interactive high-level object-oriented language (default python3 version)
  Python, the high-level, interactive object oriented language,
  includes an extensive class library with lots of goodies for
@@ -33,7 +34,7 @@ Package: python3-venv
 Architecture: any
 Multi-Arch: allowed
 Depends: python@VER@-venv (>= @UPSTRVER@), python3 (= ${binary:Version}),
-  python3-distutils (>= @STDLIBVER@), ${misc:Depends}
+  ${misc:Depends}
 Description: venv module for python3 (default python3 version)
  This package contains the venv module for the Python language (default python3
  version).
@@ -86,7 +87,7 @@ Package: python3-dev
 Architecture: any
 Multi-Arch: allowed
 Depends: python3 (= ${binary:Version}), libpython3-dev (= ${binary:Version}),
-  python@VER@-dev (>= @UPSTRVER@), python3-distutils (>= @STDLIBVER@),
+  python@VER@-dev (>= @UPSTRVER@),
   ${misc:Depends}, ${sphinxdoc:Depends}
 Breaks: python3 (<< 3.9.2-1~)
 Replaces: python3.1 (<< 3.1.2+20100706-3), python3 (<< 3.9.2-1~)
@@ -138,15 +139,6 @@ Description: IDE for Python using Tkinter (default version)
  This package is a dependency package, which depends on Debian's default
  Python 3 version's IDLE (currently v@VER@).
 
-Package: idle3
-Architecture: all
-Section: oldlibs
-Depends: python3 (>= ${binary:Version}), idle (>= ${binary:Version}), ${misc:Depends}
-Description: IDE for Python using Tkinter (transitional package)
- IDLE is an Integrated Development Environment for Python.
- .
- This package is a transitional package, you can safely remove it.
-
 Package: python3-doc
 Section: doc
 Architecture: all
@@ -184,7 +176,7 @@ Package: libpython3-dbg
 Architecture: any
 Multi-Arch: same
 Section: debug
-Depends: libpython@VER@-dbg (>= @UPSTRVER@), ${misc:Depends}
+Depends: libpython@VER@t64-dbg (>= @UPSTRVER@), ${misc:Depends}
 Breaks: python3-dbg (<< 3.8.0-1)
 Replaces: python3-dbg (<< 3.8.0-1)
 Description: debug build of the Python 3 Interpreter (version @VER@)
@@ -196,11 +188,12 @@ Architecture: any
 Multi-Arch: allowed
 Depends: python3 (= ${binary:Version}),
  ${misc:Depends},
- python3-distutils (>= @STDLIBVER@),
- python3.11,
+ python3.12,
+ python3.13,
 Description: package depending on all supported Python 3 runtime versions
- The package currently depends on python3.11, in the future, dependencies on
- jython (Python for a JVM) and ironpython (Python for Mono) may be added.
+ The package currently depends on python3.12 and python3.13. In the future,
+ dependencies on jython (Python for a JVM) and ironpython (Python for Mono) may
+ be added.
  .
  This package is a dependency package used as a build dependency for other
  packages to avoid hardcoded dependencies on specific Python 3 runtimes.
@@ -213,10 +206,12 @@ Depends: python3 (= ${binary:Version}),
  python3-all (= ${binary:Version}),
  python3-dev (= ${binary:Version}),
  ${misc:Depends},
- python3.11-dev,
+ python3.12-dev,
+ python3.13-dev,
 Description: package depending on all supported Python 3 development packages
- The package currently depends on python3.11-dev, in the future, dependencies
- on jython (Python for a JVM) and ironpython (Python for Mono) may be added.
+ The package currently depends on python3.12-dev and python3.13-dev. In the
+ future, dependencies on jython (Python for a JVM) and ironpython (Python for
+ Mono) may be added.
  .
  This package is a dependency package used as a build dependency for other
  packages to avoid hardcoded dependencies on specific Python 3 development
@@ -231,25 +226,45 @@ Depends: python3 (= ${binary:Version}),
  python3-all (= ${binary:Version}),
  python3-dbg (= ${binary:Version}),
  ${misc:Depends},
- python3.11-dbg,
+ python3.12-dbg,
+ python3.13-dbg,
 Description: package depending on all supported Python 3 debugging packages
- The package currently depends on python3.11-dbg, in the future, dependencies
- on jython (Python for a JVM) and ironpython (Python for Mono) may be added.
+ The package currently depends on python3.12-dbg and python3.13-dbg. In the
+ future, dependencies on jython (Python for a JVM) and ironpython (Python for
+ Mono) may be added.
  .
  This package is a dependency package used as a build dependency for other
  packages to avoid hardcoded dependencies on specific Python 3 debug packages.
 
+Package: python3-all-venv
+Architecture: any
+Multi-Arch: allowed
+Depends: python3 (= ${binary:Version}),
+ python3-all (= ${binary:Version}),
+ python3-venv (= ${binary:Version}),
+ ${misc:Depends},
+ python3.12-venv,
+ python3.13-venv,
+Description: package depending on all supported Python 3 venv modules
+ The package currently depends on python3.12-venv and python3.13-venv. In the
+ future, dependencies on jython (Python for a JVM) and ironpython (Python for
+ Mono) may be added.
+ .
+ This package is a dependency package used as a build dependency for other
+ packages to avoid hardcoded dependencies on specific Python 3 venv packages.
+
 Package: libpython3-all-dev
 Architecture: any
 Multi-Arch: same
 Section: libdevel
 Depends: libpython3-dev (= ${binary:Version}),
  ${misc:Depends},
- libpython3.11-dev,
+ libpython3.12-dev,
+ libpython3.13-dev,
 Description: package depending on all supported Python 3 development packages
- The package currently depends on libpython3.11-dev, in the future,
- dependencies on jython (Python for a JVM) and ironpython (Python for Mono) may
- be added.
+ The package currently depends on libpython3.12-dev and libpython3.13-dev. In
+ the future, dependencies on jython (Python for a JVM) and ironpython (Python
+ for Mono) may be added.
  .
  This package is a dependency package used as a build dependency for other
  packages to avoid hardcoded dependencies on specific Python 3 development
@@ -261,11 +276,12 @@ Multi-Arch: same
 Section: debug
 Depends: libpython3-dbg (= ${binary:Version}),
  ${misc:Depends},
- libpython3.11-dbg,
+ libpython3.12t64-dbg,
+ libpython3.13-dbg,
 Description: package depending on all supported Python 3 debugging packages
- The package currently depends on libpython3.11-dbg, in the future,
- dependencies on jython (Python for a JVM) and ironpython (Python for Mono) may
- be added.
+ The package currently depends on libpython3.12-dbg and libpython3.13-dbg. In
+ the future, dependencies on jython (Python for a JVM) and ironpython (Python
+ for Mono) may be added.
  .
  This package is a dependency package used as a build dependency for other
  packages to avoid hardcoded dependencies on specific Python 3 debug packages.
@@ -274,8 +290,6 @@ Package: 2to3
 Architecture: all
 Multi-Arch: foreign
 Depends: python3-lib2to3 (>= @STDLIBVER@), python3 (>= ${binary:Version}), ${misc:Depends}
-Breaks: python (<< 2.7.14-4)
-Replaces: python (<< 2.7.14-4)
 Description: 2to3 binary using python3
  2to3 is a Python program that reads Python 2.x source code and applies a
  series of fixers to transform it into valid Python 3.x code. The standard
@@ -295,7 +309,6 @@ Depends: python3 (= ${binary:Version}),
   python3-venv (= ${binary:Version}),
   2to3,
   idle,
-  python3-distutils,
   python3-gdbm,
   python3-lib2to3,
   python3-tk,
@@ -309,7 +322,7 @@ Description: Default Python Interpreter with complete class library
  .
  This package is a dependency package, which depends on the full
  standard library of Python for Python developers. Including modules
- used only at build-time, such as venv and distutils, and modules with
+ used only at build-time, such as venv, and modules with
  complex dependencies, such as tk and IDLE. All batteries included.
  .
  This package depends on Debian's default python 3 version's full
diff --git a/debian/debian_defaults b/debian/debian_defaults
index 2a1939e8ce8d45db296461a9f6e6b0312444c971..37240fb3c50fb39ace3024235a9ffaf060716e4d 100644
--- a/debian/debian_defaults
+++ b/debian/debian_defaults
@@ -1,12 +1,12 @@
 [DEFAULT]
 # the default python3 version
-default-version = python3.11
+default-version = python3.12
 
 # all supported python3 versions
-supported-versions = python3.11
+supported-versions = python3.12, python3.13
 
 # formerly supported python3 versions
-old-versions = python3.1, python3.2, python3.3, python3.4, python3.5, python3.6, python3.7, python3.8, python3.9, python3.10
+old-versions = python3.1, python3.2, python3.3, python3.4, python3.5, python3.6, python3.7, python3.8, python3.9, python3.10, python3.11
 
 # unsupported versions, including older versions
-unsupported-versions = python3.1, python3.2, python3.3, python3.4, python3.5, python3.6, python3.7, python3.8, python3.9, python3.10
+unsupported-versions = python3.1, python3.2, python3.3, python3.4, python3.5, python3.6, python3.7, python3.8, python3.9, python3.10, python3.11
diff --git a/debian/python3.postinst.in b/debian/python3.postinst.in
index 029026993004ba4f4d521dda4040707562cf2962..57a03c4ffb15b750d86081455a2945c587b0048f 100644
--- a/debian/python3.postinst.in
+++ b/debian/python3.postinst.in
@@ -12,6 +12,7 @@ new_config_file()
 
 case "$1" in
     configure)
+	_py_errors=
 	[ -d /etc/python3 ] || mkdir /etc/python3
 	[ -f /etc/python3/debian_config ] || new_config_file
 
@@ -24,10 +25,10 @@ case "$1" in
 	    if ! $hook rtupdate python$oldv @PVER@; then
 	        hb=$(basename $hook .rtupdate)
 	        echo >&2 "error running python rtupdate hook $hb"
-	        errors=yes
+	        _py_errors=yes
 	    fi
 	done
-	[ -z "$errors" ] || exit 4
+	[ -z "$_py_errors" ] || exit 4
 
 	if [ "$DEBIAN_FRONTEND" != noninteractive ]; then
 	    echo "running python post-rtupdate hooks for @PVER@..."
@@ -37,10 +38,10 @@ case "$1" in
 	    if ! $hook post-rtupdate python$oldv @PVER@; then
 	        hb=$(basename $hook .rtupdate)
 	        echo >&2 "error running python post-rtupdate hook $hb"
-	        errors=yes
+	        _py_errors=yes
 	    fi
 	done
-	[ -z "$errors" ] || exit 5
+	[ -z "$_py_errors" ] || exit 5
 esac
 
 if which py3compile >/dev/null 2>&1; then
diff --git a/debian/python3.preinst.in b/debian/python3.preinst.in
index d385b2ed9e248d8f762113bb6f1ec2536e95f5aa..e2b6ae2a0b3f29cbeb155e6578901b0da9b58909 100644
--- a/debian/python3.preinst.in
+++ b/debian/python3.preinst.in
@@ -9,6 +9,7 @@ update-alternatives --auto /usr/bin/python3 >/dev/null 2>&1 || true
 
 case "$1" in
     upgrade)
+	_py_errors=
 	oldv=$(echo $2 | sed 's/^\(...\).*/\1/')
 	if [ "$DEBIAN_FRONTEND" != noninteractive ]; then
 	    echo "running python pre-rtupdate hooks for @PVER@..."
@@ -20,11 +21,11 @@ case "$1" in
 		echo >&2 "error running python pre-rtupdate hook $hb"
 		echo >&2 "running python failed-pre-rtupdate hook $hb"
 		$hook failed-pre-rtupdate python$oldv @PVER@
-		errors=yes
+		_py_errors=yes
 		break
 	    fi
 	done
-	[ -z "$errors" ] || exit 3
+	[ -z "$_py_errors" ] || exit 3
 esac
 
 #DEBHELPER#
diff --git a/debian/rules b/debian/rules
index 87622af80de118092e738fa022b56997f8417544..134d4e31e40c9ef9d9a192efbaaa5f8821643274 100755
--- a/debian/rules
+++ b/debian/rules
@@ -21,13 +21,13 @@ distribution := $(shell dpkg-vendor --query Vendor)
 distrelease  := $(shell . /etc/os-release; echo $$VERSION_CODENAME)
 
 # required python3.x version
-UPSTRVER   := 3.11.2-1~
+UPSTRVER   := 3.12.7-1~
 
 # required versions of python3-lib2to3 and python3-distutils
-STDLIBVER   := 3.11.2-1~
+STDLIBVER   := 3.12.7-1~
 
 ifeq (,$(filter $(distrelease),lenny etch squeeze wheezy lucid maverick natty oneiric precise quantal raring saucy trusty))
-  bd_i586 = dpkg-dev (>= 1.17.11), python3.11:any (>= 3.11.2-1~),
+  bd_i586 = dpkg-dev (>= 1.17.11), python3.12:any (>= 3.12.7-1~),
 else
   bd_i586 = dpkg-dev (>= 1.16.1~),
 endif
@@ -63,7 +63,8 @@ stamp-doc-policy:
 	$(MAKE) -C policy singlehtml SPHINXOPTS='-D html_theme_options.nosidebar=true'
 	( \
 	    echo 'The HTML version of the Debian Python Policy can be found in the python3-dev package'; \
-	    html2text -utf8 -style pretty policy/_build/singlehtml/index.html; \
+	    html2text -utf8 -rcfile /usr/share/doc/html2text/examples/pretty.style \
+	    policy/_build/singlehtml/index.html; \
 	) > policy/_build/python-policy.txt
 	rm -rf policy/_build/singlehtml
 
@@ -175,7 +176,7 @@ stamp-dh_python:
 	dh_testdir
 	dh_testroot
 	dh_installdirs
-	#make check_versions
+	make check_versions
 	DESTDIR=debian/python3 PREFIX=/usr make install-dev
 	DESTDIR=debian/python3-minimal PREFIX=/usr make install-runtime
 ifeq ($(with_doc),yes)
@@ -226,7 +227,7 @@ endif
 	dh_installdocs -i $(NOPKGS) --all debian/README.Debian
 	dh_installchangelogs -i $(NOPKGS)
 
-	for p in examples idle idle3; do \
+	for p in examples idle; do \
 	  case $$p in idle*) : ;; *) p=python3-$$p; esac; \
 	  rm -rf debian/$$p/usr/share/doc/$$p; \
 	  ln -sf python3 debian/$$p/usr/share/doc/$$p; \
diff --git a/debpython/files.py b/debpython/files.py
index 2f6304c9ca49e17e1188d7b313c785ba29778539..aa43c377dd8d01c68a8a99e2327e795c9b03449a 100644
--- a/debpython/files.py
+++ b/debpython/files.py
@@ -19,7 +19,7 @@
 # THE SOFTWARE.
 
 import logging
-from os import walk
+from os import environ, walk
 from os.path import abspath, isfile, join
 from subprocess import Popen, PIPE
 from debpython import PUBLIC_DIR_RE
@@ -46,12 +46,14 @@ def from_directory(dname, extensions=('.py',)):
 def from_package(package_name, extensions=('.py',)):
     """Generate *.py file names available in given package."""
     extensions = tuple(extensions)  # .endswith doesn't like list
+    env = environ.copy()
+    env["LC_ALL"] = "C.UTF-8"
     process = Popen(('/usr/bin/dpkg', '-L', package_name), stdout=PIPE,
-                         stderr=PIPE)
+                         stderr=PIPE, env=env)
     stdout, stderr = process.communicate()
     if process.returncode != 0:
         raise Exception("cannot get content of %s" % package_name)
-    stdout = str(stdout, 'utf-8')
+    stdout = stdout.decode('utf-8', errors='replace')
     for line in stdout.splitlines():
         if line.endswith(extensions):
             yield line
diff --git a/debpython/interpreter.py b/debpython/interpreter.py
index cc7b8929e356e8d17912c81ddfafa7526d391830..45b14dbf97cfdb2fab9b302de74da20562f55e70 100644
--- a/debpython/interpreter.py
+++ b/debpython/interpreter.py
@@ -230,7 +230,7 @@ class Interpreter:
         version = Version(version or self.version)
         if self.impl == 'cpython' and version << Version('3'):
             return ''
-        result = self._execute('import imp; print(imp.get_magic())', version)
+        result = self._execute('import importlib.util; print(importlib.util.MAGIC_NUMBER)', version)
         return eval(result)
 
     def magic_tag(self, version=None):
@@ -243,7 +243,7 @@ class Interpreter:
         version = Version(version or self.version)
         if self.impl == 'cpython' and version << Version('3.2'):
             return ''
-        return self._execute('import imp; print(imp.get_tag())', version)
+        return self._execute('import sys; print(sys.implementation.cache_tag)', version)
 
     def multiarch(self, version=None):
         """Return multiarch tag."""
diff --git a/py3clean.rst b/py3clean.rst
index a969c38d7b47a1f7d656e86bf96b1f78f6f510e3..7a4e38cfe1e1a747081ada2e950d8b433e5ac8a3 100644
--- a/py3clean.rst
+++ b/py3clean.rst
@@ -19,7 +19,7 @@ OPTIONS
 
 -h, --help	show this help message and exit
 
--v, --verbose	turn verbose more one
+-v, --verbose	turn verbose mode on
 
 -q, --quiet	be quiet
 
diff --git a/runtime.d/public_modules.rtremove b/runtime.d/public_modules.rtremove
index f8be991376e58537b72ee927c346b205b917e250..7137f49faad94561ed001b6f3e7704f2d6a00954 100755
--- a/runtime.d/public_modules.rtremove
+++ b/runtime.d/public_modules.rtremove
@@ -13,7 +13,7 @@ else
 	if [ "$VERSION" = 3.1 ]; then
 		find /usr/lib/python3.1/dist-packages -name '*.py[co]' -delete
 	else
-		TAG=`python$VERSION -c "import imp; print(imp.magic_tags[imp.get_magic()])"` \
+		TAG=`python$VERSION -c "import sys; print(sys.implementation.cache_tag)"` \
 		find /usr/lib/python3/dist-packages -name "*.$TAG.py[co]" -delete
 		find /usr/lib/python3/dist-packages -depth -empty -name '__pycache__' -delete
 	fi