Skip to content

strptime() fails to parse month names containing İ (U+0130) #136028

Closed

Description

@serhiy-storchaka

Bug report

Bug description:

strptime() fails to parse month names containing "İ" (U+0130, LATIN CAPITAL LETTER I WITH DOT ABOVE) like "İyun" or "İyul". This affects locales 'az_AZ', 'ber_DZ', 'ber_MA' and 'crh_UA'.

This happens because 'İ'.lower() == 'i\u0307', but the re module only supports 1-to-1 character matching in case-insensitive mode.

There are several ways to fix this:

  1. Do not convert month names (and any other names) to lower case in _strptime.LocaleTime. This is a large change and it would make converting names to indices more complex and/or slower. This is universal way which would work with any other letters which are converted to multiple characters in lower case (but currently 'İ' the only such case in Linux locales).
  2. Just fix the regular expressions created from lower-cased month names. This only works for 'İ' in month names, but this is all that is needed for now.

The third way -- converting the input string to lower case before parsing -- does not work, because Z for timezone is case-sensitive.

CPython versions tested on:

CPython main branch

Operating systems tested on:

No response

Linked PRs

Activity

  1. added
    type-bugAn unexpected behavior, bug, or error
    3.13only security fixes
    3.14bugs and security fixes
    3.15bugs and security fixes
    on Jun 27, 2025
  2. added 4 commits that reference this issue on Jun 27, 2025
  3. added 2 commits that reference this issue on Jun 27, 2025
  4. added 2 commits that reference this issue on Jun 27, 2025
  5. added
    stdlibStandard Library Python modules in the Lib/ directory
    on Jun 27, 2025
  6. added a commit that references this issue on Jul 11, 2025
  7. added a commit that references this issue on Jul 12, 2025
  8. added a commit that references this issue on Aug 4, 2025
  9. added a commit that references this issue on Aug 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

3.13only security fixes3.14bugs and security fixes3.15bugs and security fixesstdlibStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or error

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions