Skip to content

Commit 29408fc

Browse files
committed
iter
1 parent c6ba052 commit 29408fc

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

doc/sphinxext/github_link.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@ def _linkcode_resolve(domain, info, package, url_fmt, revision):
2626
>>> _linkcode_resolve('py', {'module': 'tty',
2727
... 'fullname': 'setraw'},
2828
... package='tty',
29-
... url_fmt='http://hg.python.org/cpython/file/'
29+
... url_fmt='https://hg.python.org/cpython/file/'
3030
... '{revision}/Lib/{package}/{path}#L{lineno}',
3131
... revision='xxxx')
32-
'http://hg.python.org/cpython/file/xxxx/Lib/tty/tty.py#L18'
32+
'https://hg.python.org/cpython/file/xxxx/Lib/tty/tty.py#L18'
3333
"""
3434

3535
if revision is None:
@@ -40,12 +40,13 @@ def _linkcode_resolve(domain, info, package, url_fmt, revision):
4040
return
4141

4242
class_name = info["fullname"].split(".")[0]
43-
if type(class_name) != str: # noqa: E721
44-
# Python 2 only
45-
class_name = class_name.encode("utf-8")
4643
module = __import__(info["module"], fromlist=[class_name])
4744
obj = attrgetter(info["fullname"])(module)
4845

46+
# Unwrap the object to get the correct source
47+
# file in case that is wrapped by a decorator
48+
obj = inspect.unwrap(obj)
49+
4950
try:
5051
fn = inspect.getsourcefile(obj)
5152
except Exception:

0 commit comments

Comments
 (0)