Jelle Zijlstra <jelle.zijls...@gmail.com> added the comment:

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.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue41232>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to