diff --git a/doc/source/conf.py b/doc/source/conf.py index 29f947e1144ea..f0cf3a977416f 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -569,7 +569,11 @@ def linkcode_resolve(domain, info): return None try: - fn = inspect.getsourcefile(obj) + # inspect.unwrap() was added in Python version 3.4 + if sys.version_info >= (3, 5): + fn = inspect.getsourcefile(inspect.unwrap(obj)) + else: + fn = inspect.getsourcefile(obj) except: fn = None if not fn: