diff options
Diffstat (limited to 'Lib/functools.py')
| -rw-r--r-- | Lib/functools.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/Lib/functools.py b/Lib/functools.py index c2c228280f..bd1334b578 100644 --- a/Lib/functools.py +++ b/Lib/functools.py @@ -38,9 +38,14 @@ def update_wrapper(wrapper, are updated with the corresponding attribute from the wrapped function (defaults to functools.WRAPPER_UPDATES) """ + wrapper.__wrapped__ = wrapped for attr in assigned: - if hasattr(wrapped, attr): - setattr(wrapper, attr, getattr(wrapped, attr)) + try: + value = getattr(wrapped, attr) + except AttributeError: + pass + else: + setattr(wrapper, attr, value) for attr in updated: getattr(wrapper, attr).update(getattr(wrapped, attr, {})) # Return the wrapper so this can be used as a decorator via partial() |
