Skip to content

Support locale for FormatSpec n #4613

Closed

Description

@youknowone

See #4609 to check related test and place to edit.

I marked it as good first issue because it is not deeply coupled to RustPython core.
But without knowledge of locale and number formatting, it will not be very easy.

Activity

  1. deepakkrsoni commented on Sep 7, 2024

    @deepakkrsoni

    Hey i would like to contriubute to this issue, can you send me more details regarding the issue, and help me a bit to initiate with the issue ?

  2. youknowone commented on Sep 8, 2024

    @youknowone
    MemberAuthor

    @glitchxxx0 Hi! RustPython codebase is changed a lot since #4609 is written.

    Linux machine is recommended to run tests.

    1. Remove @unittest.expectedFailure from the test https://github.com/RustPython/RustPython/blob/main/Lib/test/test_types.py#L424-L425
    2. rustpython-format is now placed in different repository. This task will be multi-repository tasks. The relocated source code is here: https://github.com/RustPython/Parser/blob/main/format/src/format.rs
    3. FormatSpec::format_int have to take locale information from somewhere out of the format, which can be used for n format. Because FormatSpec or rustpython-format is not expected to know about platform-specific locale handling, there must be.. something to do it.

    Because many things are changed, I don't think this is a good first issue anymore.

    Since everybody has different view for problems, sharing everything about the issue is not easy. Please share me any blocking issues what makes you stuck or not to dive in coding. I'll try to catch what's missing for you.

    Thank you for visiting!

  3. youknowone commented on Oct 7, 2026

    @youknowone
    MemberAuthor

    Locale-aware format spec n is implemented.

    format(1234567, "n") and format(1234.5, "n") match the active LC_NUMERIC grouping (verified for en_US.UTF-8 and de_DE.UTF-8). The related tests in Lib/test/test_types.py (test_int__format__locale, test_float__format__locale) are unmarked.

    Closing as resolved. Same work as #5181.

    — commented by Grok 4.6

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

    A-stdlibC-bugSomething isn't workingC-compatA discrepancy between RustPython and CPython

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions