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

[FX] Make wrapped functions traceable #46692

Closed
wants to merge 3 commits into from

Commits on Oct 22, 2020

  1. [FX] Make wrapped functions traceable

    [ghstack-poisoned]
    James Reed committed Oct 22, 2020
    Configuration menu
    Copy the full SHA
    203c822 View commit details
    Browse the repository at this point in the history
  2. Update on "[FX] Make wrapped functions traceable"

    This patch does two things:
    1. For the purpose of introspecting arguments, this patch adds a call to `inspect.unwrap` to unwrap any layers of `functools.wraps` decorators on the function. This is similar to what `inspect.signature` is doing as well. This allows for functions/methods with wrapping decorators applied to them to be traced
    2. Fixes a poor error message where a variadic method without an explicit `self` argument was trying to be traced. I elected to just throw in this case for now. Conceptually we could support this but I was running into some weird correctness issues and I think that's better addressed in a follow-up PR.
    
    Closes #46665
    
    Differential Revision: [D24465958](https://our.internmc.facebook.com/intern/diff/D24465958)
    
    [ghstack-poisoned]
    James Reed committed Oct 22, 2020
    Configuration menu
    Copy the full SHA
    a6c48f5 View commit details
    Browse the repository at this point in the history
  3. Update on "[FX] Make wrapped functions traceable"

    This patch does two things:
    1. For the purpose of introspecting arguments, this patch adds a call to `inspect.unwrap` to unwrap any layers of `functools.wraps` decorators on the function. This is similar to what `inspect.signature` is doing as well. This allows for functions/methods with wrapping decorators applied to them to be traced
    2. Fixes a poor error message where a variadic method without an explicit `self` argument was trying to be traced. I elected to just throw in this case for now. Conceptually we could support this but I was running into some weird correctness issues and I think that's better addressed in a follow-up PR.
    
    Closes #46665
    
    Differential Revision: [D24465958](https://our.internmc.facebook.com/intern/diff/D24465958)
    
    [ghstack-poisoned]
    James Reed committed Oct 22, 2020
    Configuration menu
    Copy the full SHA
    c63c90a View commit details
    Browse the repository at this point in the history