[New-bugs-announce] [issue17482] functools.update_wrapper doesn't overwrite attributes correctly
Nick Coghlan
report at bugs.python.org
Tue Mar 19 18:35:42 CET 2013
New submission from Nick Coghlan:
functools.update_wrapper inadvertently overwrites the just set __wrapped__ attribute when it updates the contents of __dict__.
This means the intended __wrapped__ chain is never created - instead, for every function in a wrapper stack, __wrapped__ will always refer to the innermost function.
This means that using __wrapped__ to bypass functools.lru_cache doesn't work correctly if the decorated function already has __wrapped__ set.
Explicitly setting __signature__ fortunately still works correctly, since that is checked before recursing down through __wrapped__ in inspect.signature.
----------
messages: 184648
nosy: ncoghlan
priority: normal
severity: normal
stage: test needed
status: open
title: functools.update_wrapper doesn't overwrite attributes correctly
type: behavior
versions: Python 3.4
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue17482>
_______________________________________
More information about the New-bugs-announce
mailing list