Uh oh!
There was an error while loading. Please reload this page.
gh-124342: Wrap __annotate__ functions in functools.update_wrapper - #124346
gh-124342: Wrap __annotate__ functions in functools.update_wrapper#124346JelleZijlstra wants to merge 2 commits into
Conversation
vstinner
left a comment
There was a problem hiding this comment.
LGTM.
I was just surprised that updating func.__annotations__ after update_wrapper(wrapper, func) doesn't update wrapper.__annotations__. Don't get me wrong, I'm fine with this behavior.
| func = _get_get_annotations() | ||
| return func(wrapped, format=format) |
There was a problem hiding this comment.
| func=_get_get_annotations() | |
| returnfunc(wrapped, format=format) | |
| get_annotations=_get_get_annotations() | |
| returnget_annotations(wrapped, format=format) |
vstinner
commented
Sep 24, 2024
Another surprising behavior. I'm discovering When I update annotations of the wrapped function, I would expect getting the same value for both cases. Either |
vstinner
commented
Sep 24, 2024
cc @sobolevn |
JelleZijlstra
commented
Sep 24, 2024
This is because we use |
functools.update_wrapperimplementation #124342📚 Documentation preview 📚: https://cpython-previews--124346.org.readthedocs.build/