Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
johnhaddon opened this issue Feb 20, 2023 · 0 comments
Open

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

johnhaddon opened this issue Feb 20, 2023 · 0 comments

Comments

@johnhaddon
Copy link
Member

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.

johnhaddon added a commit to johnhaddon/gaffer that referenced this issue Feb 20, 2023
I removed this in e323014 after verifying that the OCIO bug it worked around was now fixed properly. But what I didn't realise is that we have our _own_ equivalent bug in ImageEngine/cortex#1338. So I'm reverting the change until we have time to fix properly in Cortex.

Fixed GafferHQ#5158
johnhaddon added a commit to johnhaddon/gaffer that referenced this issue Feb 20, 2023
I removed this in e323014 after verifying that the OCIO bug it worked around was now fixed properly. But what I didn't realise is that we have our _own_ equivalent bug in ImageEngine/cortex#1338. So I'm reverting the change until we have time to fix properly in Cortex.

Fixes GafferHQ#5158
johnhaddon added a commit to johnhaddon/gaffer that referenced this issue Feb 24, 2023
I removed this in e323014 after verifying that the OCIO bug it worked around was now fixed properly. But what I didn't realise is that we have our _own_ equivalent bug in ImageEngine/cortex#1338. So I'm reverting the change until we have time to fix properly in Cortex.

Fixes GafferHQ#5158
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant