From b67aafd8bb5d9c69bc1dc16592f2767b2dc616bb Mon Sep 17 00:00:00 2001 From: vkk800 Date: Sat, 13 Oct 2018 18:05:43 +0300 Subject: [PATCH 1/3] add inspect.unwrap() to source file search --- doc/source/conf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/source/conf.py b/doc/source/conf.py index 29f947e1144ea..09d18cdf678a2 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -569,7 +569,7 @@ def linkcode_resolve(domain, info): return None try: - fn = inspect.getsourcefile(obj) + fn = inspect.getsourcefile(inspect.unwrap(obj)) except: fn = None if not fn: From c09f86c38bd1dfd5e3b0e3bad2798611a88f3a3a Mon Sep 17 00:00:00 2001 From: vkk800 Date: Sun, 4 Nov 2018 16:46:53 +0200 Subject: [PATCH 2/3] Add check for older Python versions --- doc/source/conf.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/doc/source/conf.py b/doc/source/conf.py index 09d18cdf678a2..31c155c97c385 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(inspect.unwrap(obj)) + # inspect.unwrap() was added in Python version 3.4 + if sys.version_info >= (3, 4): + fn = inspect.getsourcefile(inspect.unwrap(obj)) + else: + fn = inspect.getsourcefile(obj) except: fn = None if not fn: From e0cd676e8af1ad888f5ef7570aef876ba62853ed Mon Sep 17 00:00:00 2001 From: Marc Garcia Date: Sun, 4 Nov 2018 20:15:52 +0200 Subject: [PATCH 3/3] Change version number Co-Authored-By: vkk800 --- doc/source/conf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/source/conf.py b/doc/source/conf.py index 31c155c97c385..f0cf3a977416f 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -570,7 +570,7 @@ def linkcode_resolve(domain, info): try: # inspect.unwrap() was added in Python version 3.4 - if sys.version_info >= (3, 4): + if sys.version_info >= (3, 5): fn = inspect.getsourcefile(inspect.unwrap(obj)) else: fn = inspect.getsourcefile(obj)