gh-91904: Fix setting envvar PYTHONREGRTEST_UNICODE_GUARD#91905
gh-91904: Fix setting envvar PYTHONREGRTEST_UNICODE_GUARD#91905serhiy-storchaka merged 2 commits intopython:mainfrom
Conversation
|
🤖 New build scheduled with the buildbot fleet by @serhiy-storchaka for commit 83046e7e2084773e7c82ef73eb7e928d09fd91d6 🤖 If you want to schedule another build, you need to add the ":hammer: test-with-buildbots" label again. |
It always failed on non-UTF-8 locale and prevented running regrtests.
Lib/test/libregrtest/setup.py
Outdated
There was a problem hiding this comment.
os.environb is a wrapper to os.environ. You can use os.fsencode()/os.fsdecode() to set the key in os.environ.
There was a problem hiding this comment.
Rather os.environ is a wrapper to os.environb.
There was a problem hiding this comment.
It's fine if you want to use os.environb. It's just that I regret that I added it: surrogateescape of PEP 383 is a better solution to use Unicode (os.environ) on all platforms. It avoids treating Unix differently. os.environb is just here to reduce suprises for Unix users. Internally, os.environ and os.environb are sharing the same Python dict.
There was a problem hiding this comment.
And this dict contains bytes.
If use os.environ, there will be double conversion: encode(decode(value)). I am not sure that it is lossless in all cases.
83046e7 to
a351699
Compare
|
🤖 New build scheduled with the buildbot fleet by @serhiy-storchaka for commit f16859b 🤖 If you want to schedule another build, you need to add the ":hammer: test-with-buildbots" label again. |
|
Thanks @serhiy-storchaka for the PR 🌮🎉.. I'm working now to backport this PR to: 3.10. |
|
GH-91911 is a backport of this pull request to the 3.10 branch. |
…onGH-91905) It always failed on non-UTF-8 locale and prevented running regrtests. (cherry picked from commit 54d068a) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
It always failed on non-UTF-8 locale and prevented running regrtests.
Closes #91904.