SystemError in time.strptime with non-English locale

Create issue
Issue #3079 resolved
Ondrej B created an issue

I’m trying to build Pillow on PyPy3.6 using latest nightly pypy-c-jit-97573-3035e3be6a6d-win32.

I’m running into a SystemError:

E   SystemError: unexpected internal exception (please report a bug): <OutOfRange object at 0x566ed0c>; internal traceback was dumped to stderr

c:\pypy-c-jit-97573-3035e3be6a6d-win32\lib-python\3\_strptime.py:95: SystemError
---------------------------- Captured stderr call -----------------------------
RPython traceback:
  File "pypy_interpreter.c", line 46473, in BuiltinCode1_fastcall_1
  File "implement_2.c", line 2303, in fastfunc_descr_lower_1_1
  File "pypy_objspace_std_7.c", line 38028, in _lower_unicode
  File "rpython_rlib.c", line 17550, in _nonascii_unichr_as_utf8_append

This issue happens every time when running all Pillow tests, but running the failing test individually doesn’t reproduce this issue.

Full log: https://ci.appveyor.com/project/nulano/pillow/builds/27570685/job/3a9a5k889njigrkb#L8823

Comments (7)

  1. Ronan Lamy

    The issue is that time.strftime() assumes a UTF-8 locale. I can easily reproduce it on Linux:

    (pypy3-0920) ~/dev/stuff$ python -c "import locale; locale.setlocale(locale.LC_TIME, 'fr_FR'); from datetime import date; print(date(2019, 8, 17).strftime('%B').lower())"
    RPython traceback:
      File "pypy_interpreter.c", line 44493, in BuiltinCode1_fastcall_1
      File "implement_3.c", line 8511, in fastfunc_descr_lower_1_1
      File "pypy_objspace_std_7.c", line 55708, in _lower_unicode
      File "rpython_rlib.c", line 14955, in _nonascii_unichr_as_utf8_append
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
    SystemError: unexpected internal exception (please report a bug): <OutOfRange object at 0x7fbd980e1db0>; internal traceback was dumped to stderr 
    

    (Expected output is août)

  2. mattip

    it seems in strftime we are not encoding the format string with the locale and decoding the result with the locale.

  3. Log in to comment