Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

locale.nl_langinfo(locale.ERA) is broken #125411

Closed as duplicate of#126727
Closed as duplicate of#126727
Labels
3.13bugs and security fixes3.14bugs and security fixes3.15new features, bugs and security fixesextension-modulesC modules in the Modules dirtype-bugAn unexpected behavior, bug, or error
@serhiy-storchaka

Description

@serhiy-storchaka

Bug report

It is broken in the same way aslocale.nl_langinfo(locale.ALT_DIGITS) was broken (see#124969), although not to the same degree. It returns the last (current) era.

importlocale,subprocessalllocales=subprocess.check_output(['locale','-a']).decode().split()forlocinalllocales:if'.'inlocor'@'inloc:continuetry:_=locale.setlocale(locale.LC_ALL,loc)exceptlocale.Error:continueera=locale.nl_langinfo(locale.ERA)ifera:print(loc,era)

Output:

cmn_TW +:2:1913/01/01:+*:民國:%EC%Ey年hak_TW +:2:1913/01/01:+*:民國:%EC%Ey年ja_JP +:2:2020/01/01:+*:令和:%EC%Ey年japanese +:2:2020/01/01:+*:令和:%EC%Ey年lo_LA +:1:-543/01/01:+*:ພ.ສ.:%EC %Eylzh_TW +:2:1913/01/01:+*:民國:%EC%Ey年nan_TW +:2:1913/01/01:+*:民國:%EC%Ey年thai +:1:-543/01/01:+*:พ.ศ.:%EC %Eyth_TH +:1:-543/01/01:+*:พ.ศ.:%EC %Eyzh_TW +:2:1913/01/01:+*:民國:%EC%Ey年

The result is not completely useless, as it can be used to format and parse the current dates. But dates before the start of the current era (it is 2020 in Japan) cannot be proceeded.

The result should be a tuple, containing information for all eras, but this is a breaking change. So, perhaps such change cannot be backported.

cc@methane

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.13bugs and security fixes3.14bugs and security fixes3.15new features, bugs and security fixesextension-modulesC modules in the Modules dirtype-bugAn unexpected behavior, bug, or error

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp