llvm / llvm/llvm-project

shtest-encoding.py breaks with python 3.14

Open Beginner friendly
#178,262 0 comments 0 reactions 0 assignees View on GitHub
test-suite tools:llvm-lit
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

The llvm-21-tools package ships a test file that contains non-UTF-8 characters without an encoding declaration, causing package installation to fail with Python 3.14.

**Affected Package**
llvm-21-tools 1:21.1.8-1ubuntu1

**Problematic File**
/usr/lib/llvm-21/build/utils/lit/tests/shtest-encoding.py

**Error**
When Python 3.14 is the default interpreter, installing llvm-21-tools triggers:
SyntaxError: Non-UTF-8 code starting with '\xc2' on line 3, but no encoding declared

This occurs during package post-installation when Python attempts to byte-compile the file. The error causes llvm-21-tools configuration to fail, which blocks installation of:
- clang-tidy-21
- python3-pygments (via rtupdate hooks)
- Any package build-depending on LLVM 21 toolchain

**Impact**
This is a Python 3.14 transition blocker affecting the entire Ubuntu archive. Any package that build-depends on clang-21, clang-tidy-21, clang-tools-21, llvm-21-dev, or llvm-21-tools will fail to build when Python 3.14 is default.

**Technical Details**
Line 3 of shtest-encoding.py contains byte 0xc2 (non-UTF-8 character) but lacks a PEP 263 encoding declaration (e.g., # -*- coding: utf-8 -*-). Python 3.14 enforces PEP 263 strictly and fails to compile such files, while Python 3.13 is more lenient.

Verification:
$ python3.14 -m py_compile /usr/lib/llvm-21/build/utils/lit/tests/shtest-encoding.py
File "/usr/lib/llvm-21/build/utils/lit/tests/shtest-encoding.py", line 3
SyntaxError: Non-UTF-8 code starting with '\xc2'

$ sed -n '3p' /usr/lib/llvm-21/build/utils/lit/tests/shtest-encoding.py | xxd
(shows 0xc2 byte)

Debian bug report: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1125979

Contributor guide

Open the contributing guide

Research direction

Start with /usr/lib/llvm-21/build/utils/lit/tests/shtest-encoding.py and inspect line 3, then reproduce the failure with python3.14 -m py_compile. Done means the file compiles under Python 3.14 and llvm-21-tools can complete installation without the post-installation failure.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
compilers
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.