Skip to content

Preserve call signature in @deprecated #2367

Closed

Description

@embray

And perhaps in other decorators as well. As mentioned here I'm hoping to write a function that can programmatically generate functions with a given call signature. Once that's done it will be helpful in implementing a version of functools.wraps that also preserves the original function's call signature (perhaps with a few caveats, such as limited support for default arguments).

Activity

  1. added this to the Future milestone on Apr 24, 2014
  2. self-assigned this
    on Apr 24, 2014
  3. mwcraig commented on Apr 28, 2014

    @mwcraig
    Member

    FWIW, I'm using the snippet below to restore the function signature in the decorator I'm using for logging in ccdproc...fixes up the docs but doesn't actually restore the signature. py3.3 and up have inspect.signature, which might save a few keystrokes...

        original_signature = inspect.formatargspec(*inspect.getargspec(func))
        original_signature = "{0}{1}".format(func.__name__, original_signature)
        func.__doc__ = "\n".join([original_signature, func.__doc__])
  4. pllim commented on Dec 21, 2017

    @pllim
    Member

    I see that #2849 was merged a long time ago. Is this still an issue?

  5. added
    Close?Tell stale bot that this issue/PR is stale
    on Dec 21, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Close?Tell stale bot that this issue/PR is staleutils

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions