[New-bugs-announce] [issue37154] test_utf8_mode: test_env_var() fails on AMD64 Fedora Rawhide Clang Installed 3.7

STINNER Victor report at bugs.python.org
Tue Jun 4 12:55:02 EDT 2019


New submission from STINNER Victor <vstinner at redhat.com>:

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 at python-builder-rawhide$ env|grep -E 'LC_|LANG'
LANG=en_US.UTF-8

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

----------
components: Tests
messages: 344603
nosy: vstinner
priority: normal
severity: normal
status: open
title: test_utf8_mode: test_env_var() fails on AMD64 Fedora Rawhide Clang Installed 3.7
versions: Python 3.7

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue37154>
_______________________________________


More information about the New-bugs-announce mailing list