[New-bugs-announce] [issue45386] xmlrpc.client unimportable due to strfmt ValueError

R report at bugs.python.org
Wed Oct 6 02:53:27 EDT 2021


New submission from R <rtobarc at gmail.com>:

This is a problem caused by https://bugs.python.org/issue13305.

When running python in SerenityOS (https://serenityos.org/), the xmlrpc.client module fails to be imported. This is because the code that decides which format to use for getting 4-digit years, which issues a call to strfmt, raises a ValueError. The ValueError is raised because the second format that is tested yields no output with Serenity's strfmt implementation, so timemodule.strfmt returns NULL.

For reference, this is the code that fails:


_day0 = datetime(1, 1, 1)
if _day0.strftime('%Y') == '0001':      # Mac OS X
    def _iso8601_format(value):
        return value.strftime("%Y%m%dT%H:%M:%S")
elif _day0.strftime('%4Y') == '0001':   # Linux   <-- ValueError
    def _iso8601_format(value):
        return value.strftime("%4Y%m%dT%H:%M:%S")
else:
    def _iso8601_format(value):
        return value.strftime("%Y%m%dT%H:%M:%S").zfill(17)
del _day0

We have a local patch that improves on the current code, which I'll post as a PR now.

----------
components: Library (Lib)
messages: 403288
nosy: rtobar2
priority: normal
severity: normal
status: open
title: xmlrpc.client unimportable due to strfmt ValueError
versions: Python 3.10

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


More information about the New-bugs-announce mailing list