Skip to content

Drop PYTHONIOENCODING for Python >= 3.16 - #1144

Merged
yosifkit merged 1 commit into
docker-library:masterfrom
jnoordsij:drop-pythonioencoding
Oct 23, 2026
Merged

yosifkit merged 1 commit into
docker-library:masterfrom
jnoordsij:drop-pythonioencoding

Conversation

@jnoordsij

Copy link
Copy Markdown
Contributor

Per #1135 (comment):

FWIW I've also created jnoordsij@198d714, which I noticed as probably relevant now that 3.15 has declared UTF-8 as the default everywhere. To be conservative and prevent dramas like #570, I've made it to target just the 3.16 rc, which should be a very safe option to test the waters I'd say.

@tianon tianon left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I managed to get a paperclip counter to reproduce the failure on 3.14 and below and it confirmed that it cannot reproduce on 3.15 and above even with this disabled 🥳

$ docker run --rm python:3.13-windowsservercore python -c 'print(chr(0x4e2d))'
中
$ docker run --rm --env PYTHONIOENCODING= python:3.13-windowsservercore python -c 'print(chr(0x4e2d))'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
    print(chr(0x4e2d))
    ~~~~~^^^^^^^^^^^^^
  File "C:\Python\Lib\encodings\cp1252.py", line 19, in encode
    return codecs.charmap_encode(input,self.errors,encoding_table)[0]
           ~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'charmap' codec can't encode character '\u4e2d' in position 0: character maps to <undefined>
$ docker run --rm --env PYTHONIOENCODING= python:3.15-windowsservercore python -c 'print(chr(0x4e2d))'
中

Comment thread Dockerfile-windows.template Outdated
Comment thread Dockerfile-windows.template Outdated
Comment on lines +19 to +20
# reproducer: docker run --rm python:{{ env.version }}-windowsservercore-{{ env.windowsRelease }} python -c 'print(chr(0x4e2d))'
# https://github.com/docker-library/python/pull/1144#pullrequestreview-5634536246

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we really want to rebuild the rest of the windows images for a comment addition to the Dockerfile?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤷 doesn't really bother me, but I can adjust if it bothers you

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems a bit heavy, especially for windows image sizes.

@tianon
tianon force-pushed the drop-pythonioencoding branch from 3f1d7a9 to 21476be Compare October 23, 2026 22:24
@yosifkit
yosifkit merged commit 6c812a5 into docker-library:master Oct 23, 2026
85 of 87 checks passed
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)
@jnoordsij
jnoordsij deleted the drop-pythonioencoding branch October 24, 2026 07:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants