Repository navigation
LWLP-4918: Preserve non-UTF-8 Python sources during version rewrites - #138
Merged
Jonathan Gangi (JAVGan) merged 2 commits intoNov 10, 2026
Conversation
added 2 commits
November 10, 2026 16:21
Read and write Python candidates as bytes with surrogateescape so PEP 263 source files can be scanned and rewritten without corrupting their original bytes. Authoritative metadata files continue to use strict UTF-8. Assisted-by: Codex (GPT-5.6 Sol)
Carry the Python-source policy with each planned rewrite so symlinked paths use the same read and write handling. Restore universal-newline normalization for Python sources and add regression coverage for symlinked non-UTF-8 files, CR/CRLF inputs, strict explicit rules, and unchanged fixtures. Assisted-by: Codex (GPT-5.6 Sol)
Jonathan Gangi (JAVGan)
approved these changes
Nov 10, 2026
Jonathan Gangi (JAVGan)
merged commit Nov 10, 2026
38f74a1
into
konflux-lightwell:main
5 of 8 checks passed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
LWLP-4918: Preserve non-UTF-8 Python sources during version rewrites
Summary
lightwell-source-to-sdistno longer fails when a package’s default version-metadata scan encounters a Python source file that is not valid UTF-8. PEP 263 sources, including pylint’s Latin-1 test fixture, can now be scanned and rewritten without corrupting their original non-UTF-8 bytes.Problem
The default version rewrite previously read every
.pyfile with strict UTF-8 decoding:That caused deterministic failures for packages that intentionally ship non-UTF-8 Python fixtures, such as:
The failing task reported:
This blocked all affected Python cumulative builds at
source-to-sdist.Root cause
_plan_default_rewrites()scans every.pyfile under the source tree and previously decoded each one as strict UTF-8. Python source files are not required to be UTF-8; PEP 263 permits other source encodings.Fix
errors="surrogateescape"..pyfile whose resolved target has a different suffix uses the same read and write policy.pyproject.toml,setup.cfg,PKG-INFO,METADATA) continue to require strict UTF-8.Testing
Added regression coverage for:
__version__.pyfile whose resolved target has a different suffixValidated with:
Results:
Issue
LWLP-4918