From: Brett Cannon Date: Wed, 8 Feb 2012 23:44:14 +0000 (-0500) Subject: Don't fail in the face of a lacking attribute when wrapping a X-Git-Tag: v3.3.0a1~213 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8490fab4add07e4db261053fb420c2e411f82026;p=python Don't fail in the face of a lacking attribute when wrapping a function. --- diff --git a/Lib/importlib/_bootstrap.py b/Lib/importlib/_bootstrap.py index f0de77bc62..e2dd086911 100644 --- a/Lib/importlib/_bootstrap.py +++ b/Lib/importlib/_bootstrap.py @@ -170,7 +170,8 @@ def _write_atomic(path, data): 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__)