[Python-Dev] xmlrpclib and dates before 1900

skip at pobox.com skip at pobox.com
Thu Apr 3 05:36:24 CEST 2008

    Ralf> anyone care to take a look at:
    Ralf> http://bugs.python.org/issue2014
    Ralf> It's about xmlrpclib not being able to send datetime objects with
    Ralf> dates before 1900.

It's actually not xmlrpclib which has the limitation, but
datetime.strftime().  That's a known limitation.  Here's the comment in the
datetime code:

        /* Give up if the year is before 1900.
         * Python strftime() plays games with the year, and different
         * games depending on whether envar PYTHON2K is set.  This makes
         * years before 1900 a nightmare, even if the platform strftime
         * supports them (and not all do).
         * We could get a lot farther here by avoiding Python's strftime
         * wrapper and calling the C strftime() directly, but that isn't
         * an option in the Python implementation of this module.

That, in turn, calls time.strftime() which calls the underlying system's
strftime() library function.

Personally, I don't think patching xmlrpclib is the right place to "fix"
this problem.  It's possible that the datetime comment is no longer correct
and that limitation should be reconsidered.  I see no other mention of
PYTHON2K in any .c, .h or .py files in the trunk.


More information about the Python-Dev mailing list