Skip to content

Decorators break function signatures #77

Closed

Description

@hynek

The client does a common anti-pattern of doing a closure with *args,**kwargs but that sadly breaks introspection of wrapped methods.

This is a concrete problem e.g. if you wrap Pyramid views that get different arguments depending on how many arguments are present (either context, request or just request).

You can find more information on this in these blog posts: https://github.com/GrahamDumpleton/wrapt/tree/master/blog

Solutions to it is to either use or copy/paste from the wrapt (better) or decorator (OK-ish) packages.

Activity

  1. brian-brazil commented on Apr 14, 2016

    @brian-brazil
    Contributor

    Would you like to send a pull request to fix this?

    wrapt appears to have C dependencies, so that's not going to work out.

  2. hynek commented on Apr 15, 2016

    @hynek
    ContributorAuthor

    So you could live with depending on decorator? It’s python-only without further dependencies.

    I still have the problem that I can’t run the tests locally on OS X because of the s.connect(('localhost', 0)) thing. If you’d fix that, I’ll happily fix your decorators. :)

  3. brian-brazil commented on Apr 15, 2016

    @brian-brazil
    Contributor

    So you could live with depending on decorator? It’s python-only without further dependencies.

    I'd prefer to copy it in. While it's old enough that it should be everywhere, let's play it safe.

  4. hynek commented on Apr 18, 2016

    @hynek
    ContributorAuthor

    As you wish.

    I still need you to fix the test suite tho. :)

  5. brian-brazil commented on Apr 18, 2016

    @brian-brazil
    Contributor

    If you've got an alternative way to get the machine's IP that also works on Windows and Linux then I'm happy to change it.

  6. hynek commented on Apr 18, 2016

    @hynek
    ContributorAuthor

    I‘m fine with if you just skip the test on OS X (and mostly likely all BSDs? at least FreeBSD breaks too).

    I just need a way to run tests locally. Once that’s fixed, I can do the tox/Travis CI/codecov integration for you too if you wish. By not being able to run the test suite on all BSDs you’re limiting the set of contributors quite a bit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions