Skip to content

gh-124476: Fix decoding from the locale encoding in the C.UTF-8 locale #132477

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

serhiy-storchaka
Copy link
Member

@serhiy-storchaka serhiy-storchaka commented Apr 13, 2025

Copy link
Member

@vstinner vstinner left a comment

Choose a reason for hiding this comment

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

LGTM.

It seems correct to me to generate a surrogate character (U+DCxx) when surrogateescape is used (when errors is _Py_ERROR_SURROGATEESCAPE) and _Py_mbrtowc() fails with INCOMPLETE_CHARACTER.

@serhiy-storchaka serhiy-storchaka changed the title gh-124476: Fix decoding from the locale encoding on C.UTF-8 locale gh-124476: Fix decoding from the locale encoding in the C.UTF-8 locale Apr 14, 2025
@serhiy-storchaka serhiy-storchaka merged commit 102f825 into python:main Apr 14, 2025
42 checks passed
@miss-islington-app
Copy link

Thanks @serhiy-storchaka for the PR 🌮🎉.. I'm working now to backport this PR to: 3.13.
🐍🍒⛏🤖

@miss-islington-app
Copy link

Sorry, @serhiy-storchaka, I could not cleanly backport this to 3.13 due to a conflict.
Please backport using cherry_picker on command line.

cherry_picker 102f825c5112cbe6985edc0971822b07bd778135 3.13

@serhiy-storchaka serhiy-storchaka deleted the decode-locale-surrogateescape branch April 14, 2025 18:32
serhiy-storchaka added a commit to serhiy-storchaka/cpython that referenced this pull request Apr 14, 2025
…C.UTF-8 locale (pythonGH-132477)

(cherry picked from commit 102f825)

Co-authored-by: Serhiy Storchaka <[email protected]>
@bedevere-app
Copy link

bedevere-app bot commented Apr 14, 2025

GH-132528 is a backport of this pull request to the 3.13 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.13 bugs and security fixes label Apr 14, 2025
serhiy-storchaka added a commit that referenced this pull request Apr 14, 2025
…8 locale (GH-132477) (ПР-132528)

(cherry picked from commit 102f825)
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