[issue2979] use_datetime in SimpleXMLRPCServer

Charles-François Natali report at bugs.python.org
Mon Oct 31 11:55:16 CET 2011


Charles-François Natali <neologix at free.fr> added the comment:

2096158376e5 broke test_xmlrpc:

"""
======================================================================
ERROR: test_datetime_before_1900 (test.test_xmlrpc.XMLRPCTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/cf/python/cpython/Lib/test/test_xmlrpc.py", line 62, in test_datetime_before_1900
    (newdt,), m = xmlrpclib.loads(s, use_datetime=1)
  File "/home/cf/python/cpython/Lib/xmlrpc/client.py", line 969, in loads
    p.feed(data)
  File "/home/cf/python/cpython/Lib/xmlrpc/client.py", line 430, in feed
    self._parser.Parse(data, 0)
  File "/home/cf/python/cpython/Lib/xmlrpc/client.py", line 662, in end
    return f(self, "".join(self._data))
  File "/home/cf/python/cpython/Lib/xmlrpc/client.py", line 745, in end_dateTime
    value = _datetime_type(data)
  File "/home/cf/python/cpython/Lib/xmlrpc/client.py", line 359, in _datetime_type
    return datetime.strptime(data, "%Y%m%dT%H:%M:%S")
  File "/home/cf/python/cpython/Lib/_strptime.py", line 488, in _strptime_datetime
    tt, fraction = _strptime(data_string, format)
  File "/home/cf/python/cpython/Lib/_strptime.py", line 337, in _strptime
    (data_string, format))
ValueError: time data '10210T11:41:23' does not match format '%Y%m%dT%H:%M:%S'

----------------------------------------------------------------------
"""

That's because datetime.strptime() expects a year ("%Y") on exactly 4 digits:
"""
            #XXX: Does 'Y' need to worry about having less or more than
            #     4 digits?
            'Y': r"(?P<Y>\d\d\d\d)",
"""

----------
nosy: +neologix

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue2979>
_______________________________________


More information about the Python-bugs-list mailing list