Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xmlrpclib cannot send datetime objects with dates before 1900 #46298

Closed
schmir mannequin opened this issue Feb 5, 2008 · 9 comments
Closed

xmlrpclib cannot send datetime objects with dates before 1900 #46298

schmir mannequin opened this issue Feb 5, 2008 · 9 comments
Assignees
Labels
stdlib Python modules in the Lib dir type-feature A feature request or enhancement

Comments

@schmir
Copy link
Mannequin

schmir mannequin commented Feb 5, 2008

BPO 2014
Nosy @smontanaro, @tiran
Files
  • xmlrpc_date_before_1900.txt: patch against release25-maint
  • xmlrpc_date_before_1900_r61011.txt: updated version. patch against trunk r61011
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = 'https://github.com/smontanaro'
    closed_at = <Date 2008-04-18.20:36:29.156>
    created_at = <Date 2008-02-05.23:12:36.557>
    labels = ['type-feature', 'library']
    title = 'xmlrpclib cannot send datetime objects with dates before 1900'
    updated_at = <Date 2008-04-20.11:52:03.876>
    user = 'https://bugs.python.org/schmir'

    bugs.python.org fields:

    activity = <Date 2008-04-20.11:52:03.876>
    actor = 'schmir'
    assignee = 'skip.montanaro'
    closed = True
    closed_date = <Date 2008-04-18.20:36:29.156>
    closer = 'skip.montanaro'
    components = ['Library (Lib)']
    creation = <Date 2008-02-05.23:12:36.557>
    creator = 'schmir'
    dependencies = []
    files = ['9358', '9520']
    hgrepos = []
    issue_num = 2014
    keywords = ['patch']
    message_count = 9.0
    messages = ['62082', '62092', '62094', '62518', '62810', '65608', '65611', '65623', '65644']
    nosy_count = 3.0
    nosy_names = ['skip.montanaro', 'christian.heimes', 'schmir']
    pr_nums = []
    priority = 'normal'
    resolution = 'accepted'
    stage = None
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue2014'
    versions = ['Python 2.6', 'Python 3.0']

    @schmir
    Copy link
    Mannequin Author

    schmir mannequin commented Feb 5, 2008

    xmlrpclib uses datetime.strftime which cannot handle dates before 1900.
    this patch adds a custom date formatting function, which does not have
    this restriction. It also contains 2 additional unit tests, which both
    fail with the unpatched version.

    @schmir schmir mannequin added type-bug An unexpected behavior, bug, or error stdlib Python modules in the Lib dir labels Feb 5, 2008
    @tiran
    Copy link
    Member

    tiran commented Feb 6, 2008

    Does your patch also work on systems which don't allow negative values
    for time_t?

    @tiran tiran added type-feature A feature request or enhancement and removed type-bug An unexpected behavior, bug, or error labels Feb 6, 2008
    @schmir
    Copy link
    Mannequin Author

    schmir mannequin commented Feb 6, 2008

    Well, all it basically does is changing calls to obj.strftime to a
    custom string formatting function (where obj is a datetime.datetime,
    datetime.date or datetime.time). These strftime calls are made during
    object marshalling. So, all the objects to be marshalled are created by
    the program itself. The datetime module allows those dates to be
    created, so I think it should be safe.
    The unmarshalling code did not change, so it's possible to receive a
    date before 1900, but not to send it back...

    But to answer your question. I don't know, I don't even know a platform,
    which use an unsigned time_t.

    @schmir
    Copy link
    Mannequin Author

    schmir mannequin commented Feb 18, 2008

    http://bugs.python.org/issue1777412 describes the cause of this issue
    (i.e. strftime not being able to handle years before 1900).

    @schmir
    Copy link
    Mannequin Author

    schmir mannequin commented Feb 23, 2008

    Attaching an updated version of the patch against trunk revision 61011.

    @schmir
    Copy link
    Mannequin Author

    schmir mannequin commented Apr 18, 2008

    guido says it's ok to fix the issue in xmlrpclib only:
    http://mail.python.org/pipermail/python-dev/2008-April/078396.html

    I'm also attaching a dummy.diff in order to have a patch keyword...
    If someone is willing to commit this, I'll check if it still applies to
    trunk and maybe update the diff.

    @smontanaro
    Copy link
    Contributor

    working on it

    @smontanaro smontanaro self-assigned this Apr 18, 2008
    @smontanaro
    Copy link
    Contributor

    Checked in on trunk as r62378. Will let the normal 3.0 merge process
    suck it over to the py3k branch.

    @schmir
    Copy link
    Mannequin Author

    schmir mannequin commented Apr 20, 2008

    Skip, thanks for handling this.

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    stdlib Python modules in the Lib dir type-feature A feature request or enhancement
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants