I experienced the same bug but worked around it by replacing /usr/share/python3/debpython/interpreter.py with a version from a system with "python3-minimal/unstable,now 3.11.4-1 amd64" installed.
Here's the diff: diff -Naur /usr/share/python3/debpython/interpreter.py interpreter.py --- /usr/share/python3/debpython/interpreter.py 2023-07-04 05:08:14.000000000 -0500 +++ interpreter.py 2023-07-04 11:56:57.957669696 -0500 @@ -230,7 +230,7 @@ version = Version(version or self.version) if self.impl == 'cpython' and version << Version('3'): return '' - result = self._execute('import importlib; print(importlib.util.MAGIC_NUMBER)', version) + result = self._execute('import imp; print(imp.get_magic())', version) return eval(result) def magic_tag(self, version=None): @@ -243,7 +243,7 @@ version = Version(version or self.version) if self.impl == 'cpython' and version << Version('3.2'): return '' - return self._execute('import sys; print(sys.implementation.cache_tag)', version) + return self._execute('import imp; print(imp.get_tag())', version) def multiarch(self, version=None): """Return multiarch tag."""