This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients vstinner
Date 2019-06-04.16:55:02
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1559667302.55.0.345195224781.issue37154@roundup.psfhosted.org>
In-reply-to
Content
AMD64 Fedora Rawhide Clang Installed 3.7:
https://buildbot.python.org/all/#/builders/195/builds/104


FAIL: test_env_var (test.test_utf8_mode.UTF8ModeTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/buildbot/buildarea/3.7.cstratak-fedora.installed/build/target/lib/python3.7/test/test_utf8_mode.py", line 93, in test_env_var
    self.assertEqual(out, '0')
AssertionError: '1' != '0'
- 1
+ 0


On the buildbot:

vstinner@python-builder-rawhide$ env|grep -E 'LC_|LANG'
LANG=en_US.UTF-8

vstinner@python-builder-rawhide$ locale
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
LANG=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
(...)
LC_ALL=


Extract of the test:

        # Cannot test with the POSIX locale, since the POSIX locale enables
        # the UTF-8 mode
        if not self.posix_locale():
            # PYTHONUTF8 should be ignored if -E is used
            out = self.get_output('-E', '-c', code, PYTHONUTF8='1')
            self.assertEqual(out, '0')

The problem seems to be posix_locale() which fails if the C locale has been coerced by PEP 538:

    POSIX_LOCALES = ('C', 'POSIX')

    def posix_locale(self):
        loc = locale.setlocale(locale.LC_CTYPE, None)
        return (loc in POSIX_LOCALES)

This code doesn't work if LC_CTYPE is already coerced.
History
Date User Action Args
2019-06-04 16:55:02vstinnersetrecipients: + vstinner
2019-06-04 16:55:02vstinnersetmessageid: <1559667302.55.0.345195224781.issue37154@roundup.psfhosted.org>
2019-06-04 16:55:02vstinnerlinkissue37154 messages
2019-06-04 16:55:02vstinnercreate