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

Add update_wrapper and fix wraps handing of missing attrs #251

Conversation

immerrr
Copy link
Contributor

@immerrr immerrr commented Jul 22, 2018

This PR should fix #250 and #165.

This is pretty-much a straight backport of Py3 implementations of update_wrapper and wraps, which is probably the easier way, but let me know if adding an extra public function update_wrapper should be avoided and this point and I'll fix it within wraps itself.

@immerrr immerrr force-pushed the add-update-wrapper-and-fix-wraps-attribute-errors branch from a45ac61 to ae270b1 Compare July 22, 2018 23:31
@immerrr
Copy link
Contributor Author

immerrr commented Aug 19, 2018

@benjaminp is there any chance of this getting accepted or at least reviewed sooner rather than later?

@immerrr
Copy link
Contributor Author

immerrr commented Nov 22, 2018

@benjaminp gentle reminder about this fix.

@@ -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)
Copy link
Owner

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?

Copy link
Contributor Author

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.

Copy link
Owner

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, done!

test_six.py Outdated Show resolved Hide resolved
test_six.py Show resolved Hide resolved
test_six.py Outdated Show resolved Hide resolved
@immerrr immerrr force-pushed the add-update-wrapper-and-fix-wraps-attribute-errors branch from 6044165 to 83cc15c Compare November 15, 2019 20:01
@benjaminp
Copy link
Owner

looks like CI is failing

@immerrr immerrr force-pushed the add-update-wrapper-and-fix-wraps-attribute-errors branch from 83cc15c to e2b5dac Compare November 19, 2019 07:24
@immerrr
Copy link
Contributor Author

immerrr commented Nov 19, 2019

Yeah, sorry, I missed the notification, should be fixed now.

@benjaminp benjaminp merged commit 1988faf into benjaminp:master Jan 7, 2020
benjaminp added a commit that referenced this pull request Jan 7, 2020
@immerrr immerrr deleted the add-update-wrapper-and-fix-wraps-attribute-errors branch January 29, 2020 08:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

six.wraps doesn't ignore non-existing attributes like Python 3 does
2 participants