Skip to content

test_date_locale2 fails on AIX #139624

@furkanonder

Description

@furkanonder

Bug report

Bug description:

AIX's strptime implementation exhibits different behavior for 2-digit year interpretation compared to other platforms. The expected behavior should interpret 2-digit years 00-68 as 2000-2068 and 69-99 as 1969-1999, but AIX appears to use different cutoff logic

-bash-4.2$ ./python -m test test_strptime -m test_date_locale2 -v
== CPython 3.15.0a0 (main, Oct 5 2025, 21:17:47) [GCC 8.3.0]
== AIX-2-00FA9D314C00-powerpc-32bit big-endian
== Python build: debug
== cwd: /python/pdev/cpython-main/build/test_python_worker_5309142æ
== CPU count: 16
== encodings: locale=ISO8859-1 FS=utf-8
== resources: all test resources are disabled, use -u option to unskip tests

Using random seed: 2760767720
0:00:00 Run 1 test sequentially in a single process
0:00:00 [1/1] test_strptime
test_date_locale2 (test.test_strptime.StrptimeTests.test_date_locale2) ...
  test_date_locale2 (test.test_strptime.StrptimeTests.test_date_locale2) (locale='en_US') ... FAIL
  test_date_locale2 (test.test_strptime.StrptimeTests.test_date_locale2) (locale='fr_FR') ... skipped "no locale 'fr_FR'"
  test_date_locale2 (test.test_strptime.StrptimeTests.test_date_locale2) (locale='de_DE') ... skipped "no locale 'de_DE'"
  test_date_locale2 (test.test_strptime.StrptimeTests.test_date_locale2) (locale='ja_JP') ... skipped "no locale 'ja_JP'"
  test_date_locale2 (test.test_strptime.StrptimeTests.test_date_locale2) (locale='eu_ES') ... skipped "no locale 'eu_ES'"
  test_date_locale2 (test.test_strptime.StrptimeTests.test_date_locale2) (locale='ar_AE') ... skipped "no locale 'ar_AE'"
  test_date_locale2 (test.test_strptime.StrptimeTests.test_date_locale2) (locale='my_MM') ... skipped "no locale 'my_MM'"
  test_date_locale2 (test.test_strptime.StrptimeTests.test_date_locale2) (locale='shn_MM') ... skipped "no locale 'shn_MM'"
  test_date_locale2 (test.test_strptime.StrptimeTests.test_date_locale2) (locale='lzh_TW') ... skipped "no locale 'lzh_TW'"

======================================================================
FAIL: test_date_locale2 (test.test_strptime.StrptimeTests.test_date_locale2) (locale='en_US')
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/python/pdev/cpython-main/Lib/test/support/__init__.py", line 1045, in wrapper
    func(self, *args, **kwargs)
    ~~~~^^^^^^^^^^^^^^^^^^^^^^^
  File "/python/pdev/cpython-main/Lib/test/test_strptime.py", line 576, in test_date_locale2
    self.roundtrip('%x', slice(0, 3), (1900, 1, 1, 0, 0, 0, 0, 1, 0))
    ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/python/pdev/cpython-main/Lib/test/test_strptime.py", line 306, in roundtrip
    self.assertEqual(strp_output[position], time_tuple[position],
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                    "testing of %r format failed; %r -> %r != %r" %
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                     (fmt, strf_output, strp_output[position],
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                      time_tuple[position]))
                      ^^^^^^^^^^^^^^^^^^^^^^
AssertionError: Tuples differ: (2000, 1, 1) != (1900, 1, 1)

First differing element 0:
2000
1900

- (2000, 1, 1)
?  ^^

+ (1900, 1, 1)
?  ^^
 : testing of '%x' format failed; '01/01/00' -> (2000, 1, 1) != (1900, 1, 1)

----------------------------------------------------------------------
Ran 1 test in 0.022s

FAILED (failures=1, skipped=8)
test test_strptime failed
0:00:00 [1/1/1] test_strptime failed (1 failure)

== Tests result: FAILURE ==

1 test failed:
    test_strptime

Total duration: 561 ms
Total tests: run=1 (filtered) failures=1 skipped=8
Total test files: run=1/1 (filtered) failed=1
Result: FAILURE

Environment

  • AIX Version: 7200-05-05-2245 (AIX 7.2 TL5 SP5)

I think updating the test suite to skip problematic locales on AIX for the %x format test, similar to the existing Solaris(#125785) workaround, would be a good choice.

CPython versions tested on:

CPython main branch, 3.15, 3.14, 3.13

Operating systems tested on:

Other

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.13bugs and security fixes3.14bugs and security fixes3.15new features, bugs and security fixesOS-unsupportedextension-modulesC modules in the Modules dirtestsTests in the Lib/test dirtype-bugAn unexpected behavior, bug, or error

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions