Mercurial > cpython-lru_cache-weakref
diff Lib/importlib/_bootstrap.py @ 74838:7a6fd7cd16e9
Don't fail in the face of a lacking attribute when wrapping a
function.
| author | Brett Cannon <brett@python.org> |
|---|---|
| date | Wed, 08 Feb 2012 18:44:14 -0500 |
| parents | ecf4a7bb8807 |
| children | 322e6f818cd2 |
line wrap: on
line diff
--- a/Lib/importlib/_bootstrap.py Thu Feb 09 00:11:00 2012 +0100 +++ b/Lib/importlib/_bootstrap.py Wed Feb 08 18:44:14 2012 -0500 @@ -170,7 +170,8 @@ def _wrap(new, old): """Simple substitute for functools.wraps.""" for replace in ['__module__', '__name__', '__qualname__', '__doc__']: - setattr(new, replace, getattr(old, replace)) + if hasattr(old, replace): + setattr(new, replace, getattr(old, replace)) new.__dict__.update(old.__dict__)
