Skip to content

Conversation

@hliu0
Copy link
Contributor

@hliu0hliu0 commented May 22, 2019

VxWorks uses UTF-8 as the system encoding. So the test case test_c_locale_coercion.py need to be updated to use UTF-8 on VxWorks.

https://bugs.python.org/issue31904

Copy link
Member

@vstinnervstinner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your doc is wrong: getpreferredencoding() isn't hardcoded to UTF-8 on VxWorks.

You have to hack Lib/_bootlocale.py and Lib/locale.py using sys.platform == "vxworks" to make this effective.

I guess that you can just replace if hasattr(sys, 'getandroidapilevel'): with if hasattr(sys, 'getandroidapilevel') and sys.platform == "vxworks":, and update the related comments.

is enabled.

On VxWorks, always return ``'UTF-8'``, the locale and the *do_setlocale*
argument are ignored.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
argument are ignored.
argument is ignored.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"are" is used for "the locale" and "the do_setlocale argument".

This line is mostly the same as comment for Android at line 328:

On Android or in the UTF-8 mode (:option:-Xutf8 option), always
return 'UTF-8', the locale and the do_setlocale argument are ignored.

@bedevere-bot
Copy link

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

@hliu0
Copy link
ContributorAuthor

Your doc is wrong: getpreferredencoding() isn't hardcoded to UTF-8 on VxWorks.

You have to hack Lib/_bootlocale.py and Lib/locale.py using sys.platform == "vxworks" to make this effective.

I guess that you can just replace if hasattr(sys, 'getandroidapilevel'): with if hasattr(sys, 'getandroidapilevel') and sys.platform == "vxworks":, and update the related comments.

On VxWorks, always return "UTF-8" with sys.flags.utf8_mode is True in both locale.py&_bootlocale.py:
if sys.flags.utf8_mode:
return 'UTF-8'
So it does't need to add judgement with sys.platform == "vxworks".

@hliu0
Copy link
ContributorAuthor

I have made the requested changes; please review again.

@bedevere-bot
Copy link

Thanks for making the requested changes!

@vstinner: please review the changes made to this pull request.

@pxinwr
Copy link
Contributor

The author of this PR has quit the job. A new PR #19448 was created to replace this one. Please anyone helps to close this PR.

@corona10
Copy link
Member

@pxinwr Thank you for letting me know

@corona10corona10 closed this Apr 9, 2020
@pxinwrpxinwr deleted the fix-issue-31904-hliu0 branch July 12, 2021 09:42
@kuhlenoughkuhlenoughmannequin mentioned this pull request Jan 12, 2024
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting change reviewtestsTests in the Lib/test dir

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants

@hliu0@bedevere-bot@pxinwr@corona10@vstinner@the-knights-who-say-ni