-
Notifications
You must be signed in to change notification settings - Fork 272
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
Add update_wrapper and fix wraps handing of missing attrs #251
Add update_wrapper and fix wraps handing of missing attrs #251
Conversation
a45ac61
to
ae270b1
Compare
@benjaminp is there any chance of this getting accepted or at least reviewed sooner rather than later? |
@benjaminp gentle reminder about this fix. |
documentation/index.rst
Outdated
@@ -252,11 +252,22 @@ functions and methods is the stdlib :mod:`py3:inspect` module. | |||
aliased to :class:`py3:object`.) | |||
|
|||
|
|||
.. function:: update_wrapper(wrapper, wrapped, assigned=functools.WRAPPER_ASSIGNMENTS, updated=functools.WRAPPER_UPDATES) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we want to expose this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR is about adding support for __wrapped__
attribute, and there are two functions that need to be backported to provide the missing attribute: update_wrapper
and wraps
(that uses update_wrapper
internally).
That said, the most frequently used one is wraps
, so we can make the backported update_wrapper
internal if you like.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's always better to start out private.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, done!
6044165
to
83cc15c
Compare
looks like CI is failing |
83cc15c
to
e2b5dac
Compare
Yeah, sorry, I missed the notification, should be fixed now. |
This PR should fix #250 and #165.
This is pretty-much a straight backport of Py3 implementations of
update_wrapper
andwraps
, which is probably the easier way, but let me know if adding an extra public functionupdate_wrapper
should be avoided and this point and I'll fix it withinwraps
itself.