Skip to content

bpo-31904: Only UTF-8 encoding is supported on VxWorks #13486

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

Closed
wants to merge 1 commit into from

Conversation

hliu0
Copy link
Contributor

@hliu0 hliu0 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

@vstinner vstinner 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.

@@ -331,6 +331,8 @@ The :mod:`locale` module defines the following exception and functions:
The function now always returns ``UTF-8`` on Android or if the UTF-8 mode
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
Contributor Author

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:-X utf8 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
Contributor Author

hliu0 commented May 23, 2019

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
Contributor Author

hliu0 commented May 23, 2019

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.

@csabella csabella requested a review from vstinner January 25, 2020 20:15
@pxinwr
Copy link
Contributor

pxinwr commented Apr 9, 2020

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

corona10 commented Apr 9, 2020

@pxinwr Thank you for letting me know

@corona10 corona10 closed this Apr 9, 2020
@pxinwr pxinwr deleted the fix-issue-31904-hliu0 branch July 12, 2021 09:42
@kuhlenough kuhlenough mannequin mentioned this pull request Jan 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting change review tests Tests in the Lib/test dir
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants