Skip to content

gh-155006: Encode an error handler's replacement strictly - #155008

Open
serhiy-storchaka wants to merge 1 commit into
python:mainfrom
serhiy-storchaka:gh-155006-iconv-recursion
Open

gh-155006: Encode an error handler's replacement strictly#155008
serhiy-storchaka wants to merge 1 commit into
python:mainfrom
serhiy-storchaka:gh-155006-iconv-recursion

Conversation

@serhiy-storchaka

Copy link
Copy Markdown
Member

A str replacement was re-encoded with the same error handler, so a replacement that is itself unencodable called the handler again, without end. It is encoded strictly now, and one that does not fit is reported against the input character.

replace therefore raises where it used to recurse, which includes the charsets with no '?' at all, 38 of the names here: E13B, Braille, the INIS subsets and others. ignore is unaffected.

Encoding a😀b with the four handlers recursed for 274 encodings and for none now. The test fails without the change.

The iconv codecs are new in 3.16, so there is no NEWS entry.

Encoding it with the same error handler could never terminate: a replacement
that is itself unencodable calls the handler again. A replacement that does
not fit is now reported against the input character.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant