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

asyncio is not inspecting keyword arguments of functools.partial #70841

Closed
iceb0y mannequin opened this issue Mar 28, 2016 · 6 comments
Closed

asyncio is not inspecting keyword arguments of functools.partial #70841

iceb0y mannequin opened this issue Mar 28, 2016 · 6 comments

Comments

@iceb0y
Copy link
Mannequin

iceb0y mannequin commented Mar 28, 2016

BPO 26654
Nosy @gvanrossum, @vstinner, @1st1, @iceb0y
PRs
  • [Do Not Merge] Convert Misc/NEWS so that it is managed by towncrier #552
  • 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 2016-09-15.20:02:53.258>
    created_at = <Date 2016-03-28.09:57:30.060>
    labels = ['expert-asyncio']
    title = 'asyncio is not inspecting keyword arguments of functools.partial'
    updated_at = <Date 2017-03-31.16:36:35.834>
    user = 'https://github.com/iceb0y'

    bugs.python.org fields:

    activity = <Date 2017-03-31.16:36:35.834>
    actor = 'dstufft'
    assignee = 'none'
    closed = True
    closed_date = <Date 2016-09-15.20:02:53.258>
    closer = 'yselivanov'
    components = ['asyncio']
    creation = <Date 2016-03-28.09:57:30.060>
    creator = 'iceboy'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 26654
    keywords = []
    message_count = 6.0
    messages = ['262566', '262588', '262608', '262631', '276610', '276611']
    nosy_count = 5.0
    nosy_names = ['gvanrossum', 'vstinner', 'python-dev', 'yselivanov', 'iceboy']
    pr_nums = ['552']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue26654'
    versions = ['Python 3.5']

    @iceb0y
    Copy link
    Mannequin Author

    iceb0y mannequin commented Mar 28, 2016

    import asyncio
    import functools
    
    def foo(x): raise Exception()
    
    loop = asyncio.get_event_loop()
    loop.call_soon(functools.partial(foo, x=1))
    loop.run_forever()

    Current error message:
    Exception in callback foo()() at ...:4

    Expected error message:
    Exception in callback foo(x=1)() at ...:4

    @iceb0y iceb0y mannequin added the topic-asyncio label Mar 28, 2016
    @gvanrossum
    Copy link
    Member

    Oh, wow. I didn't even know we special-case partial() there. In general we tend to focus more on positional arguments (since asyncio intentionally doesn't take keyword args for callbacks) but I see no reason why we couldn't add this here. Maybe you're interested in writing a patch yourself? You could do it as a PR for the "upstream" git repo https://github.com/python/asyncio

    @iceb0y
    Copy link
    Mannequin Author

    iceb0y mannequin commented Mar 29, 2016

    Created a PR python/asyncio#328. Please review. Thanks.

    @vstinner
    Copy link
    Member

    Oh, wow. I didn't even know we special-case partial() there.

    I wrote the code doing that. I did it to get more readable and shorter logs since asyncio produces a lot of logs.

    Example:

    Exception in callback print("Hello", "World!")() at ...:4
    

    without special case:

    Exception in functools.partial(<built-in function print>, 'Hello', 'World!') at ...:4
    

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Sep 15, 2016

    New changeset 4ab64ea31d75 by Yury Selivanov in branch '3.5':
    Issue bpo-26654: Inspect functools.partial in asyncio.Handle.__repr__.
    https://hg.python.org/cpython/rev/4ab64ea31d75

    New changeset 03257f04ee9f by Yury Selivanov in branch '3.6':
    Merge 3.5 (issue bpo-26654)
    https://hg.python.org/cpython/rev/03257f04ee9f

    New changeset 1dbe3addba28 by Yury Selivanov in branch 'default':
    Merge 3.6 (issue bpo-26654)
    https://hg.python.org/cpython/rev/1dbe3addba28

    @1st1
    Copy link
    Member

    1st1 commented Sep 15, 2016

    Merged! Thank you!

    @1st1 1st1 closed this as completed Sep 15, 2016
    @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
    Projects
    None yet
    Development

    No branches or pull requests

    3 participants