Skip to content

Use str.casefold in ConfigParser.optionxform #138251

@StSav012

Description

@StSav012

Feature or enhancement

Proposal:

As the Comparing Strings chapter reads, calling str.lower to normalize strings is only good for ASCII characters. When it comes to other Unicode ranges, it becomes much more complicated.

Yet, the current implementation keeps using lower to normalize strings.

So, I suggest the change of ConfigParser.optionxform in favor of str.casefold or even unicodedata.normalize.

It might break some code. However, I can't imagine how a sane person would miss such a behavior as optionxform currently conducts. I'd expect everyone unhappy with the usage of str.lower to overwrite optionxform a long time ago. Therefore, I'm afraid the change I suggest will not break some code but correct it.

Has this already been discussed elsewhere?

This is a minor feature, which does not need previous discussion elsewhere

Links to previous discussion of this feature:

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    pendingThe issue will be closed if no feedback is providedstdlibStandard Library Python modules in the Lib/ directorytype-featureA feature request or enhancement

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions