Skip to content

IECore.repr() should not be locale-sensitive #1338

@johnhaddon

Description

@johnhaddon

Description

IECore.repr() is using boost::lexical_cast under the hood, which is locale sensitive. In some locales, this means the result cannot be parsed by Python.

Steps to Reproduce

Run python -c "import locale; locale.setlocale( locale.LC_NUMERIC, 'fr_FR.UTF-8' ); import IECore; import imath; print( IECore.repr( imath.V2f( 1.25 ) ) )

This outputs imath.V2f( 1,25, 1,25 ) but should output imath.V2f( 1.25, 1.25 )

Recommended solution

Reimplement IECore::repr() using fmt::format(), which is fast, and ignores locale unless explicitly requested.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions