-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
LocalProxy: add __wrapped__ attribute to refer to wrapped function #924
LocalProxy: add __wrapped__ attribute to refer to wrapped function #924
Conversation
b5b2832
to
526d407
Compare
looks nice to me, can you please extend it with a unit-test for both simple cases as this is basically a new feature changing the external interface of the locals |
526d407
to
fc14e5b
Compare
@RonnyPfannschmidt done! |
fc14e5b
to
259ad70
Compare
looks good to me :) i'd like another pair of eyes on it to be sure these are the semantics we should add to werkzeug locals are very important and while this change looks very useful i'd like to avoid unwarranted disruption |
LGTM, and I'm surprised the fix is so straightforward and that there exists a good reasoning that those are correct semantics instead of a hack. Nice job.
|
Yes,
|
Excellent, thank you! |
@untitaker Any chance this can be backported to 0.11 please? |
Sorry, but I don't consider this to be a bugfix as it originally was never On Sun, Jul 31, 2016 at 07:03:51AM -0700, Riccardo Magliocchetti wrote:
|
…allets#924) (cherry picked from commit 8a84b62)
This is an attempt to fix pallets/flask#1680.
__wrapped__
attribute is a somewhat unofficial dunder-attribute used infunctools
andinspect
to refer to an underlying function of a decorator. Technically,LocalProxy
can wrap callables, so using__wrapped__
attribute does not seem much of a "workaround".If "local" is not a callable,
__wrapped__
slot is not initialized, and thus theproxy.__wrapped__
request will be forwarded to current object as previously.