Repository navigation
Set LANG on all Linux variants again, including 3.13+ - #1145
Merged
Merged
Conversation
Restore `ENV LANG C.UTF-8` on 3.13 and later, undoing the 3.13+ part of 0d53911. Without it, two groups of users break: embedded interpreters (uWSGI, mod_wsgi) before 3.15, which fall back to ASCII filesystem and stdio encodings because they don't get the locale coercion and UTF-8 mode that the `python` CLI does, and alpine on every version through 3.16-rc, where musl never gets `LC_CTYPE` set so libraries that read locale environment variables (babel) find nothing. This is the same class of failure that got the original removal reverted in f871d04. Replace the template comment with those concrete reasons, and add a one-line `docker run` reproducer for the embedded case. Regenerate the Dockerfiles.
tianon
commented
Oct 23, 2026
| # last attempted removal of LANG broke many users: | ||
| # https://github.com/docker-library/python/pull/570 | ||
| # embedded interpreter reproducer (fails with UnicodeEncodeError without LANG on 3.14 and earlier, needs a non-slim Debian variant for gcc): | ||
| # docker run --rm --env LANG= python:{{ env.version }} sh -c 'printf "#include <Python.h>\nint main(){Py_Initialize();PyRun_SimpleString(\"print(chr(252),flush=True)\");}" | gcc -x c - $(python3-config --embed --cflags --ldflags) && ./a.out' |
Member
Author
There was a problem hiding this comment.
I did think about #1144 (comment) in the context of this change too, but IMO these are useful enough context additions that they're worth getting into the provenance on the existing images (and the Linux images are a lot lighter on Hub, even if they're heavier on the build systems).
Member
Author
There was a problem hiding this comment.
On the plus side, the ones they're heaviest on should have some build cache. 🤞
yosifkit
approved these changes
Oct 23, 2026
docker-library-bot
added a commit
to docker-library-bot/official-images
that referenced
this pull request
Oct 23, 2026
Changes: - docker-library/python@d01180b5: Set LANG on all Linux variants again, including 3.13+ (docker-library/python#1145) - docker-library/python@6c812a5b: Drop PYTHONIOENCODING for Python >= 3.16 (docker-library/python#1144) - docker-library/python@bd0f6ae1: Add 3.16-rc windows variants (docker-library/python#1139)
taylorific
added a commit
to boxcutter/oci
that referenced
this pull request
Oct 24, 2026
Update Python to 3.11.17, 3.12.15, 3.13.17 and 3.14.9, add 3.15.1 (noble and slim-noble), and move the slim base images to ubuntu:jammy-20260930 and ubuntu:noble-20260930.1. Drop 3.9 and 3.10, which are EOL and have been removed upstream. Bring the Containerfiles in line with upstream: - set LANG=C.UTF-8 on 3.13 and later again, with upstream's new comment explaining why it can't be dropped (docker-library/python#1145) - append -Wl,-rpath and -Wl,--strip-all after LDFLAGS rather than relying on it ending in a -Wl option - add g++ to the slim build deps so C++ extensions build - build 3.14+ full images with libzstd-dev so compression.zstd works - bump setuptools to 79.0.1 and wheel to 0.46.3 on 3.11 - build 3.15 with --without-system-libmpdec, as upstream does on bookworm, since noble has no libmpdec-dev - match upstream's indentation of the frame-pointer case block Fix the slim build-dep cleanup, which flipped the runtime libraries the ldd scan had just marked manual back to auto, so the purge removed libsqlite3-0, libreadline8 and friends and "import sqlite3" failed on every published slim image. The new manuals are now reset to auto before the ldd scan. Also update the CI path filters for the added and removed versions, add the missing hadolint ignore to 3.12/slim-noble, fix the indentation of the 3.13 and 3.14 bake files, and strip trailing whitespace.
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.
Restore
ENV LANG C.UTF-8on 3.13 and later, undoing the 3.13+ part of 0d53911. Without it, two groups of users break: embedded interpreters (uWSGI, mod_wsgi) before 3.15, which fall back to ASCII filesystem and stdio encodings because they don't get the locale coercion and UTF-8 mode that thepythonCLI does, and alpine on every version through 3.16-rc, where musl never getsLC_CTYPEset so libraries that read locale environment variables (babel) find nothing. This is the same class of failure that got the original removal reverted in f871d04.Replace the template comment with those concrete reasons, and add a one-line
docker runreproducer for the embedded case. Regenerate the Dockerfiles.Refs: