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 benjamin.peterson
Recipients benjamin.peterson
Date 2018-09-14.04:01:28
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1536897689.03.0.956365154283.issue34672@psf.upfronthosting.co.za>
In-reply-to
Content
With the musl C library, one has failures like this:

======================================================================
FAIL: test_strptime (test.test_time.TimeTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/buildbot/buildarea/3.x.ware-alpine/build/Lib/test/test_time.py", line 273, in test_strptime
    time.strptime(strf_output, format)
ValueError: time data '' does not match format '%Z'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "/buildbot/buildarea/3.x.ware-alpine/build/Lib/test/test_time.py", line 276, in test_strptime
    (format, strf_output))
AssertionError: conversion specifier '%Z' failed with '' input.
----------------------------------------------------------------------

The root problem is that time.strptime('%Z', time.gmtime()) won't work—it returns an empty string—even though time.gmtime() will probably have a valid tm_zone field. This is because musl has a safety mechanism where it refuses to process a tm_zone entry unless it produced the string. (See https://git.musl-libc.org/cgit/musl/commit/?id=d78be392e144c338f58ce6a51d82c859126c137d.)

As a partial workaround, I propose we check whether an incoming time.struct_time instance has an tm_zone member equal to tzname[0] or tzname[1], and place one of those global strings into the C-level tm struct if they do match.
History
Date User Action Args
2018-09-14 04:01:29benjamin.petersonsetrecipients: + benjamin.peterson
2018-09-14 04:01:29benjamin.petersonsetmessageid: <1536897689.03.0.956365154283.issue34672@psf.upfronthosting.co.za>
2018-09-14 04:01:28benjamin.petersonlinkissue34672 messages
2018-09-14 04:01:28benjamin.petersoncreate