mirror of https://github.com/python/cpython
Don't fail in the face of a lacking attribute when wrapping a
function.
This commit is contained in:
parent
81a1fa5c77
commit
8490fab4ad
|
@ -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__)
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue