diff -r a89469328b78 Doc/tools/extensions/pyspecific.py --- a/Doc/tools/extensions/pyspecific.py Thu Dec 15 05:37:56 2016 +0300 +++ b/Doc/tools/extensions/pyspecific.py Wed Dec 14 20:42:57 2016 -0800 @@ -11,6 +11,8 @@ import re import codecs +import patchlevel + from os import path from time import asctime from pprint import pformat @@ -34,7 +36,7 @@ ISSUE_URI = 'https://bugs.python.org/issue%s' -SOURCE_URI = 'https://hg.python.org/cpython/file/3.5/%s' +SOURCE_URI = 'https://github.com/python/cpython/blob/%s/%s' # monkey-patch reST parser to disable alphabetic and roman enumerated lists from docutils.parsers.rst.states import Body @@ -90,7 +92,11 @@ has_t, title, target = split_explicit_title(text) title = utils.unescape(title) target = utils.unescape(target) - refnode = nodes.reference(title, title, refuri=SOURCE_URI % target) + version, _ = patchlevel.get_version_info() + if version == "3.7": + version = "master" + refnode = nodes.reference(title, title, + refuri=SOURCE_URI % (version, target)) return [refnode], []