summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrett Cannon <brett@python.org>2012-02-08 23:44:14 (GMT)
committerBrett Cannon <brett@python.org>2012-02-08 23:44:14 (GMT)
commit8490fab4add07e4db261053fb420c2e411f82026 (patch)
treed855dcabe4a5d440faae2e6a74d688acb4b1c81c
parent81a1fa5c778c4b33ca71fcf25155189545870aab (diff)
downloadcpython-8490fab4add07e4db261053fb420c2e411f82026.zip
cpython-8490fab4add07e4db261053fb420c2e411f82026.tar.gz
cpython-8490fab4add07e4db261053fb420c2e411f82026.tar.bz2
Don't fail in the face of a lacking attribute when wrapping a
function.
-rw-r--r--Lib/importlib/_bootstrap.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/Lib/importlib/_bootstrap.py b/Lib/importlib/_bootstrap.py
index f0de77b..e2dd086 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__)