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

xmlrpc.client unimportable due to strfmt ValueError #89549

Closed
rtobar mannequin opened this issue Oct 6, 2021 · 5 comments
Closed

xmlrpc.client unimportable due to strfmt ValueError #89549

rtobar mannequin opened this issue Oct 6, 2021 · 5 comments
Labels
3.9 only security fixes 3.10 only security fixes 3.11 only security fixes stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error

Comments

@rtobar
Copy link
Mannequin

rtobar mannequin commented Oct 6, 2021

BPO 45386
Nosy @ambv, @miss-islington, @rtobar, @rtobar
PRs
  • bpo-45386: Handle strftime's ValueError graciously #28765
  • [3.10] bpo-45386: Handle strftime's ValueError graciously in xmlrpc.client (GH-28765) #28934
  • [3.9] bpo-45386: Handle strftime's ValueError graciously in xmlrpc.client (GH-28765) #28935
  • 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 = None
    closed_at = <Date 2021-10-13.18:00:49.233>
    created_at = <Date 2021-10-06.06:53:26.991>
    labels = ['type-bug', 'library', '3.9', '3.10', '3.11']
    title = 'xmlrpc.client unimportable due to strfmt ValueError'
    updated_at = <Date 2021-10-13.18:00:49.232>
    user = 'https://github.com/rtobar'

    bugs.python.org fields:

    activity = <Date 2021-10-13.18:00:49.232>
    actor = 'lukasz.langa'
    assignee = 'none'
    closed = True
    closed_date = <Date 2021-10-13.18:00:49.233>
    closer = 'lukasz.langa'
    components = ['Library (Lib)']
    creation = <Date 2021-10-06.06:53:26.991>
    creator = 'rtobar2'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 45386
    keywords = ['patch']
    message_count = 5.0
    messages = ['403288', '403850', '403865', '403866', '403867']
    nosy_count = 4.0
    nosy_names = ['lukasz.langa', 'miss-islington', 'rtobar', 'rtobar2']
    pr_nums = ['28765', '28934', '28935']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue45386'
    versions = ['Python 3.9', 'Python 3.10', 'Python 3.11']

    @rtobar
    Copy link
    Mannequin Author

    rtobar mannequin commented Oct 6, 2021

    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.

    @rtobar rtobar mannequin added 3.10 only security fixes stdlib Python modules in the Lib dir labels Oct 6, 2021
    @ambv
    Copy link
    Contributor

    ambv commented Oct 13, 2021

    New changeset 1c83135 by rtobar in branch 'main':
    bpo-45386: Handle strftime's ValueError graciously in xmlrpc.client (GH-28765)
    1c83135

    @ambv
    Copy link
    Contributor

    ambv commented Oct 13, 2021

    New changeset f40b230 by Miss Islington (bot) in branch '3.10':
    bpo-45386: Handle strftime's ValueError graciously in xmlrpc.client (GH-28765) (GH-28934)
    f40b230

    @ambv
    Copy link
    Contributor

    ambv commented Oct 13, 2021

    New changeset 9210eff by Miss Islington (bot) in branch '3.9':
    bpo-45386: Handle strftime's ValueError graciously in xmlrpc.client (GH-28765) (GH-28935)
    9210eff

    @ambv
    Copy link
    Contributor

    ambv commented Oct 13, 2021

    Thanks, R! ✨ 🍰 ✨

    @ambv ambv added 3.9 only security fixes 3.11 only security fixes labels Oct 13, 2021
    @ambv ambv closed this as completed Oct 13, 2021
    @ambv ambv added type-bug An unexpected behavior, bug, or error 3.9 only security fixes 3.11 only security fixes labels Oct 13, 2021
    @ambv ambv closed this as completed Oct 13, 2021
    @ambv ambv added the type-bug An unexpected behavior, bug, or error label Oct 13, 2021
    @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
    3.9 only security fixes 3.10 only security fixes 3.11 only security fixes stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant