projects
/
python
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
81a1fa5
)
Don't fail in the face of a lacking attribute when wrapping a
author
Brett Cannon
<brett@python.org>
Wed, 8 Feb 2012 23:44:14 +0000
(18:44 -0500)
committer
Brett Cannon
<brett@python.org>
Wed, 8 Feb 2012 23:44:14 +0000
(18:44 -0500)
function.
Lib/importlib/_bootstrap.py
patch
|
blob
|
history
diff --git
a/Lib/importlib/_bootstrap.py
b/Lib/importlib/_bootstrap.py
index f0de77bc62d91d06594a755045508841f376929a..e2dd0869114d123780dd697a20751bfe8bf06a33 100644
(file)
--- 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__)