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

inspect.Signature.parameters should be an OrderedDict, not a plain dict #83956

Closed
anntzer mannequin opened this issue Feb 27, 2020 · 4 comments
Closed

inspect.Signature.parameters should be an OrderedDict, not a plain dict #83956

anntzer mannequin opened this issue Feb 27, 2020 · 4 comments
Assignees
Labels
3.9 only security fixes stdlib Python modules in the Lib dir

Comments

@anntzer
Copy link
Mannequin

anntzer mannequin commented Feb 27, 2020

BPO 39775
Nosy @methane, @cdonovick
PRs
  • bpo-39775: inspect: Change Signature.parameters back to OrderedDict. #18684
  • 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/methane'
    closed_at = <Date 2020-03-02.09:55:04.392>
    created_at = <Date 2020-02-27.13:47:39.651>
    labels = ['library', '3.9']
    title = 'inspect.Signature.parameters should be an OrderedDict, not a plain dict'
    updated_at = <Date 2020-03-02.11:09:55.099>
    user = 'https://github.com/anntzer'

    bugs.python.org fields:

    activity = <Date 2020-03-02.11:09:55.099>
    actor = 'Antony.Lee'
    assignee = 'methane'
    closed = True
    closed_date = <Date 2020-03-02.09:55:04.392>
    closer = 'methane'
    components = ['Library (Lib)']
    creation = <Date 2020-02-27.13:47:39.651>
    creator = 'Antony.Lee'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 39775
    keywords = ['patch']
    message_count = 4.0
    messages = ['362800', '362870', '362871', '363147']
    nosy_count = 2.0
    nosy_names = ['methane', 'donovick']
    pr_nums = ['18684']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue39775'
    versions = ['Python 3.9']

    @anntzer
    Copy link
    Mannequin Author

    anntzer mannequin commented Feb 27, 2020

    https://bugs.python.org/issue36350 / #12412 changed Signature.parameters and BoundArguments.arguments to be plain dicts, not OrderedDicts (for Py3.9a4). Even though I agree for BoundArguments.arguments (in fact I argued for this behavior in https://bugs.python.org/issue23080), I think Signature.parameters should remain OrderedDicts. Otherwise, one would get

        >>> inspect.signature(lambda x, y: None).parameters == inspect.signature(lambda y, x: None).parameters
        True

    which seems plain wrong (comparing the signature objects themselves still correctly return False because __eq__ explicitly considers parameter order, but one may e.g. want to compare parameters for equality while ignoring the return annotation).

    @anntzer anntzer mannequin added 3.9 only security fixes stdlib Python modules in the Lib dir labels Feb 27, 2020
    @methane
    Copy link
    Member

    methane commented Feb 28, 2020

    Would you review the PR 18684?

    @anntzer
    Copy link
    Mannequin Author

    anntzer mannequin commented Feb 28, 2020

    It looks good to me, thanks.

    @methane
    Copy link
    Member

    methane commented Mar 2, 2020

    New changeset 2110551 by Inada Naoki in branch 'master':
    bpo-39775: inspect: Change Signature.parameters back to OrderedDict. (GH-18684)
    2110551

    @methane methane closed this as completed Mar 2, 2020
    @methane methane closed this as completed Mar 2, 2020
    @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 stdlib Python modules in the Lib dir
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant