Skip to content

gh-137780: Python - Windows: Fix Unicode abort in AI gen'd code #137781

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

Closed
wants to merge 2 commits into from

Conversation

zackees
Copy link

@zackees zackees commented Aug 14, 2025

With the rise of AI generate code, python Windows is suffering from this bug at an exponentiate rate. I hope that this commit can be accepted as-is, or a conversation can be had about the proper target for a fix like this. Perhaps textio.c is too coarse grained, and it needs to be an attribute to the print function (and logging).

#137780

This commit represents fixing it for a whole class of the python standard library functions.

…ing an abort

With the rise of AI generate code, python Windows is suffering from this bug at an exponentiate rate. I hope that this commit can be accepted is, or a conversation can be had about the proper target for a fix like this. Perhaps `textio.c` is too coarse grained, and it needs to be an attribute to the print function (and logging).
@python-cla-bot
Copy link

python-cla-bot bot commented Aug 14, 2025

All commit authors signed the Contributor License Agreement.

CLA signed

@bedevere-app

This comment was marked as resolved.

@zackees

This comment was marked as resolved.

@zackees zackees changed the title Python - Windows: Fix Unicode abort in AI gen'd code Fix #137780: Python - Windows: Fix Unicode abort in AI gen'd code Aug 14, 2025
@zware zware changed the title Fix #137780: Python - Windows: Fix Unicode abort in AI gen'd code gh-137780: Python - Windows: Fix Unicode abort in AI gen'd code Aug 14, 2025
Copy link
Member

@ZeroIntensity ZeroIntensity left a comment

Choose a reason for hiding this comment

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

Unfortunately, this is a breaking change. We can't just change default values in public interfaces without a deprecation period (which is now supposed to be five years).

This is also something that needs a test case, but let's discuss on the issue whether this is worth doing first.

@bedevere-app
Copy link

bedevere-app bot commented Aug 14, 2025

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

@zackees
Copy link
Author

zackees commented Aug 14, 2025

Unfortunately, this is a breaking change. We can't just change default values in public interfaces without a deprecation period (which is now supposed to be five years).

This is also something that needs a test case, but let's discuss on the issue whether this is worth doing first.

The amount of AI emoticons are exploding.

It's a bad situation. Python windows is just breaking everywhere now. Anyway to elevate? People don't like emoticons, AI loves it.

@zware
Copy link
Member

zware commented Aug 14, 2025

@zackees Please respond on the issue. It's not clear what problem you are trying to solve.

@AA-Turner
Copy link
Member

The author cannot reproduce, issue has been closed.

@AA-Turner AA-Turner closed this Aug 14, 2025
@burtonsys
Copy link

burtonsys commented Aug 18, 2025

I have reproduced this issue in Python 3.13.6. The problem occurs whenever output containing a non-ASCII character is redirected. I've attached a zip archive with a trivial demo and a screenshot of the output:
python_bug_137781_demo_for_zackees.zip

Can issue #137780 be reopened?

Note: this was apparently caused by the same issue:
Textualize/rich#212

The workaround is:
set PYTHONIOENCODING=utf-8

@zackees
Copy link
Author

zackees commented Aug 18, 2025

Just tried to repro this and couldn't with python 3.13.7

@burtonsys
Copy link

I just installed 3.13.7 and the problem still occurs. To reproduce it, just unzip the contents of python_bug_137781_demo_for_zackees2.zip into a folder and run python_bug_137781_demo_for_zackees.bat from a command prompt, from either cmd or PowerShell, in either normal mode or Administrator mode.

python_bug_137781_demo_for_zackees2.zip

There's a screenshot in there, too.

@AA-Turner
Copy link
Member

@zackees @burtonsys please continue discussion on the issue rather than a closed PR.

@python python locked as resolved and limited conversation to collaborators Aug 19, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants