Author Jelle Zijlstra
Recipients Jelle Zijlstra, Thor Whalen, Thor Whalen2, domdfcoding, donovick, gregory.p.smith, ncoghlan, terry.reedy
Date 2021-05-02.04:52:39
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1619931159.44.0.995284665324.issue41232@roundup.psfhosted.org>
In-reply-to
Content
We could add a new argument to `@functools.wraps()` to differentiate between a wrapper with the same signature and one with a different signature.

Here's a possible design:
* functools.wraps adds a new keyword-only argument signature_changed. It defaults to False for backward compatibility.
* If signature_changed is True:
  * __annotations__ are not copied
  * __wrapped__ is not set on the wrapping function. Instead, we set a new attribute __wrapped_with_changed_signature__ (that's a pretty terrible name, open to suggestions). This will make inspect.signature not look at the wrapped function.
History
Date User Action Args
2021-05-02 04:52:39Jelle Zijlstrasetrecipients: + Jelle Zijlstra, terry.reedy, gregory.p.smith, ncoghlan, donovick, Thor Whalen, Thor Whalen2, domdfcoding
2021-05-02 04:52:39Jelle Zijlstrasetmessageid: <1619931159.44.0.995284665324.issue41232@roundup.psfhosted.org>
2021-05-02 04:52:39Jelle Zijlstralinkissue41232 messages
2021-05-02 04:52:39Jelle Zijlstracreate