Package: python3.12 Version: 3.12.0-6 Severity: normal I wanted to test something with pdb in Python 3.12, so I ran: $ pdb3.12 filename.py
Unfortunately, I then got an error: Traceback (most recent call last): File "/usr/bin/pdb3.12", line 72, in <module> import re File "/usr/lib/python3.12/re/__init__.py", line 125, in <module> from . import _compiler, _parser File "/usr/lib/python3.12/re/_compiler.py", line 18, in <module> assert _sre.MAGIC == MAGIC, "SRE module mismatch" ^^^^^^^^^^^^^^^^^^^ AssertionError: SRE module mismatch The cause of this is as follows: /usr/bin/pdb3.X is a symlink to ../lib/python3.X/pdb.py This file begins with the shebang line: #! /usr/bin/env python3 which means that it uses the default python3 version rather than the specified python3.X. In my case, it runs it under python3.11 and then unsurprisingly bombs out. The solution seems to be to replace this shebang line with #! /usr/bin/python3.X (with the X obviously replaced by the correct minor version). Looking through /usr/lib/python3.12, it transpires that this is not the only such case: /usr/lib/python3.12/base64.py:#! /usr/bin/python3.12 /usr/lib/python3.12/cgi.py:#! /usr/local/bin/python /usr/lib/python3.12/cProfile.py:#! /usr/bin/env python3 /usr/lib/python3.12/pdb.py:#! /usr/bin/env python3 /usr/lib/python3.12/platform.py:#! /usr/bin/python3.12 /usr/lib/python3.12/profile.py:#! /usr/bin/env python3 /usr/lib/python3.12/pydoc.py:#!/usr/bin/env python3 /usr/lib/python3.12/quopri.py:#! /usr/bin/python3.12 /usr/lib/python3.12/smtplib.py:#! /usr/bin/env python3 /usr/lib/python3.12/tabnanny.py:#! /usr/bin/env python3 /usr/lib/python3.12/tarfile.py:#!/usr/bin/env python3 /usr/lib/python3.12/timeit.py:#! /usr/bin/env python3 /usr/lib/python3.12/trace.py:#!/usr/bin/env python3 /usr/lib/python3.12/uu.py:#! /usr/bin/python3.12 /usr/lib/python3.12/webbrowser.py:#! /usr/bin/env python3 Many of these may not be as harmful, but there is no obvious reason (at least to me) not to fix all of them to read #! /usr/bin/python3.X Best wishes, Julian