← 输入框|github.com|刷新
Skip to content

strptime reads morning hours as afternoon in locales without am or pm markers #162812

Backlog

Description

@tonghuaroot

Bug report

when the locale has empty am and pm markers, time.strptime returns hour 13 instead of 1 in the example below. the same input returns 1 on python 3.14.10.

import locale
import time

locale.setlocale(locale.LC_TIME, 'fr_FR.UTF-8')
assert time.strftime('%p', time.gmtime(0)) == ''
assert time.strptime('01:30', '%I:%M').tm_hour == 1

CPython versions tested on:

3.15, 3.16

Operating systems tested on:

Linux, macOS

Linked PRs

Activity

  1. added
    type-bug
    on Nov 28, 2026
  2. added
    stdlib
    on Nov 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    stdlibtype-bug

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions