Commit 82296101 authored by Brett Cannon's avatar Brett Cannon

Don't fail in the face of a lacking attribute when wrapping a

function.
parent 0fb34cb3
......@@ -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__)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment