Skip to content

AI Generated code has emoticons. Python Windows print will abort in the default case. #137780

@zackees

Description

@zackees

Bug report

Bug description:

This bug is causing me endless pain on windows with Claude Code, Gemini, Qwen CLI, Cursor.ai, aider-chat.

The default error mode for the textio module used for print will raise an exception to the user. The issue is that this bug is conditional. No emoticons? No crash. When AI inserts just one emoticon, a previously working script will now abort. This is really bad too when python is printing logs, such as test runners, build tool glue, etc.. If those logs from a different coding session get AI insert emoticons, now downstream python scripts reading those logs abort.

Modules/_io/textio.c

if (errors == NULL) {
    errors = &_Py_ID(strict);
} else {
    errors = Py_NewRef(errors);
}

CPython versions tested on:

3.13

Operating systems tested on:

Windows

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    OS-windowspendingThe issue will be closed if no feedback is providedtype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions