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

__wrapped__ is always set on unbound local proxy #2497

Merged
merged 1 commit into from Aug 8, 2022
Merged

Conversation

davidism
Copy link
Member

@davidism davidism commented Aug 8, 2022

Doctest calls inspect.unwrap, which does getattr(obj, "__wrapped__"), which would fail if the proxy was anything but a function. In Flask 2.2, the proxies no longer use functions, so users started reporting that their doctests were failing.

Now the proxy always records what it's wrapping, and returns that when accessing __wrapped__ when unbound. When bound, the attribute access is always passed through to the real object, rather than always returning the proxy's value.

fixes #2485

@davidism davidism added this to the 2.2.2 milestone Aug 8, 2022
@davidism davidism linked an issue Aug 8, 2022 that may be closed by this pull request
@davidism davidism merged commit bebf46d into 2.2.x Aug 8, 2022
@davidism davidism deleted the local-wrapped branch August 8, 2022 20:53
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 23, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

doctest causes a working out of context RuntimeError with request
1 participant