New submission from R <rtob...@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 <rep...@bugs.python.org>
<https://bugs.python.org/issue45386>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to