Skip to content

[3.15] gh-87587: Fix os.device_encoding() for any console on Windows (GH-155410) - #156592

Merged
serhiy-storchaka merged 3 commits into
python:3.15from
miss-islington:backport-b4aea41-3.15
Oct 10, 2026
Merged

serhiy-storchaka merged 3 commits into
python:3.15from
miss-islington:backport-b4aea41-3.15

Conversation

@miss-islington

@miss-islington miss-islington commented Aug 29, 2026 •

Copy link
Copy Markdown
Contributor

It was hard coded to map file descriptors 0, 1 and 2 to the console code
page, but a console can be opened as any file descriptor, and other
character devices, like NUL, are not consoles.

The file handle is now queried. The UTF-8 code page is also now reported
as "utf-8" instead of "cp65001".
(cherry picked from commit b4aea41)

Co-authored-by: Serhiy Storchaka storchaka@gmail.com

…ythonGH-155410)

It was hard coded to map file descriptors 0, 1 and 2 to the console code
page, but a console can be opened as any file descriptor, and other
character devices, like NUL, are not consoles.

The file handle is now queried.  The UTF-8 code page is also now reported
as "utf-8" instead of "cp65001".
(cherry picked from commit b4aea41)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
@serhiy-storchaka
serhiy-storchaka enabled auto-merge (squash) October 10, 2026 09:13
@serhiy-storchaka
serhiy-storchaka merged commit d21c501 into python:3.15 Oct 10, 2026
53 checks passed
@miss-islington
miss-islington deleted the backport-b4aea41-3.15 branch October 10, 2026 09:44
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.

2 participants