diff -r 1ab7bcd4e176 Doc/includes/test.py --- a/Doc/includes/test.py Wed Dec 30 21:41:53 2015 +0200 +++ b/Doc/includes/test.py Fri Jan 01 09:35:33 2016 +0200 @@ -204,7 +204,7 @@ 2 import os import sys from distutils.util import get_platform -PLAT_SPEC = "%s-%s" % (get_platform(), sys.version[0:3]) +PLAT_SPEC = "%s-%d.%d" % ((get_platform(),) + sys.version_info[:2]) src = os.path.join("build", "lib.%s" % PLAT_SPEC) sys.path.append(src) diff -r 1ab7bcd4e176 Lib/distutils/command/bdist_msi.py --- a/Lib/distutils/command/bdist_msi.py Wed Dec 30 21:41:53 2015 +0200 +++ b/Lib/distutils/command/bdist_msi.py Fri Jan 01 09:35:33 2016 +0200 @@ -199,7 +199,7 @@ class bdist_msi(Command): target_version = self.target_version if not target_version: assert self.skip_build, "Should have already checked this" - target_version = sys.version[0:3] + target_version = '%d.%d' % sys.version_info[:2] plat_specifier = ".%s-%s" % (self.plat_name, target_version) build = self.get_finalized_command('build') build.build_lib = os.path.join(build.build_base, diff -r 1ab7bcd4e176 Lib/distutils/command/bdist_wininst.py --- a/Lib/distutils/command/bdist_wininst.py Wed Dec 30 21:41:53 2015 +0200 +++ b/Lib/distutils/command/bdist_wininst.py Fri Jan 01 09:35:33 2016 +0200 @@ -141,7 +141,7 @@ class bdist_wininst(Command): target_version = self.target_version if not target_version: assert self.skip_build, "Should have already checked this" - target_version = sys.version[0:3] + target_version = '%d.%d' % sys.version_info[:2] plat_specifier = ".%s-%s" % (self.plat_name, target_version) build = self.get_finalized_command('build') build.build_lib = os.path.join(build.build_base, diff -r 1ab7bcd4e176 Lib/distutils/command/build.py --- a/Lib/distutils/command/build.py Wed Dec 30 21:41:53 2015 +0200 +++ b/Lib/distutils/command/build.py Fri Jan 01 09:35:33 2016 +0200 @@ -81,7 +81,7 @@ class build(Command): "--plat-name only supported on Windows (try " "using './configure --help' on your platform)") - plat_specifier = ".%s-%s" % (self.plat_name, sys.version[0:3]) + plat_specifier = ".%s-%d.%d" % ((self.plat_name,) + sys.version_info[:2]) # Make it so Python 2.x and Python 2.x with --with-pydebug don't # share the same build directories. Doing so confuses the build @@ -114,7 +114,7 @@ class build(Command): 'temp' + plat_specifier) if self.build_scripts is None: self.build_scripts = os.path.join(self.build_base, - 'scripts-' + sys.version[0:3]) + 'scripts-%d.%d' % sys.version_info[:2]) if self.executable is None: self.executable = os.path.normpath(sys.executable) diff -r 1ab7bcd4e176 Lib/distutils/command/install_egg_info.py --- a/Lib/distutils/command/install_egg_info.py Wed Dec 30 21:41:53 2015 +0200 +++ b/Lib/distutils/command/install_egg_info.py Fri Jan 01 09:35:33 2016 +0200 @@ -21,10 +21,10 @@ class install_egg_info(Command): def finalize_options(self): self.set_undefined_options('install_lib',('install_dir','install_dir')) - basename = "%s-%s-py%s.egg-info" % ( - to_filename(safe_name(self.distribution.get_name())), - to_filename(safe_version(self.distribution.get_version())), - sys.version[:3] + basename = "%s-%s-py%d.%d.egg-info" % ( + (to_filename(safe_name(self.distribution.get_name())), + to_filename(safe_version(self.distribution.get_version()))) + + sys.version_info[:2] ) self.target = os.path.join(self.install_dir, basename) self.outputs = [self.target] diff -r 1ab7bcd4e176 Lib/distutils/sysconfig.py --- a/Lib/distutils/sysconfig.py Wed Dec 30 21:41:53 2015 +0200 +++ b/Lib/distutils/sysconfig.py Fri Jan 01 09:35:33 2016 +0200 @@ -70,7 +70,7 @@ def get_python_version(): leaving off the patchlevel. Sample return values could be '1.5' or '2.2'. """ - return sys.version[:3] + return '%d.%d' % sys.version_info[:2] def get_python_inc(plat_specific=0, prefix=None): diff -r 1ab7bcd4e176 Lib/distutils/tests/test_build.py --- a/Lib/distutils/tests/test_build.py Wed Dec 30 21:41:53 2015 +0200 +++ b/Lib/distutils/tests/test_build.py Fri Jan 01 09:35:33 2016 +0200 @@ -27,7 +27,7 @@ class BuildTestCase(support.TempdirManag # build_platlib is 'build/lib.platform-x.x[-pydebug]' # examples: # build/lib.macosx-10.3-i386-2.7 - plat_spec = '.%s-%s' % (cmd.plat_name, sys.version[0:3]) + plat_spec = '.%s-%d.%d' % ((cmd.plat_name,) + sys.version_info[:2]) if hasattr(sys, 'gettotalrefcount'): self.assertTrue(cmd.build_platlib.endswith('-pydebug')) plat_spec += '-pydebug' @@ -42,7 +42,8 @@ class BuildTestCase(support.TempdirManag self.assertEqual(cmd.build_temp, wanted) # build_scripts is build/scripts-x.x - wanted = os.path.join(cmd.build_base, 'scripts-' + sys.version[0:3]) + wanted = os.path.join(cmd.build_base, + 'scripts-%d.%d' % sys.version_info[:2]) self.assertEqual(cmd.build_scripts, wanted) # executable is os.path.normpath(sys.executable) diff -r 1ab7bcd4e176 Lib/importlib/_bootstrap_external.py --- a/Lib/importlib/_bootstrap_external.py Wed Dec 30 21:41:53 2015 +0200 +++ b/Lib/importlib/_bootstrap_external.py Fri Jan 01 09:35:33 2016 +0200 @@ -592,7 +592,7 @@ class WindowsRegistryFinder: else: registry_key = cls.REGISTRY_KEY key = registry_key.format(fullname=fullname, - sys_version=sys.version[:3]) + sys_version='%d.%d' % sys.version_info[:2]) try: with cls._open_registry(key) as hkey: filepath = _winreg.QueryValue(hkey, '') diff -r 1ab7bcd4e176 Lib/pydoc.py --- a/Lib/pydoc.py Wed Dec 30 21:41:53 2015 +0200 +++ b/Lib/pydoc.py Fri Jan 01 09:35:33 2016 +0200 @@ -1924,7 +1924,7 @@ To get a list of available modules, keyw "modules", "keywords", "symbols", or "topics". Each module also comes with a one-line summary of what it does; to list the modules whose name or summary contain a given string such as "spam", type "modules spam". -''' % tuple([sys.version[:3]]*2)) +''' % (('%d.%d' % sys.version_info[:2],) * 2)) def list(self, items, columns=4, width=80): items = list(sorted(items)) diff -r 1ab7bcd4e176 Lib/site.py --- a/Lib/site.py Wed Dec 30 21:41:53 2015 +0200 +++ b/Lib/site.py Fri Jan 01 09:35:33 2016 +0200 @@ -304,7 +304,7 @@ def getsitepackages(prefixes=None): if os.sep == '/': sitepackages.append(os.path.join(prefix, "lib", - "python" + sys.version[:3], + "python%d.%d" % sys.version_info[:2], "site-packages")) else: sitepackages.append(prefix) @@ -317,7 +317,7 @@ def getsitepackages(prefixes=None): if framework: sitepackages.append( os.path.join("/Library", framework, - sys.version[:3], "site-packages")) + '%d.%d' % sys.version_info[:2], "site-packages")) return sitepackages def addsitepackages(known_paths, prefixes=None): diff -r 1ab7bcd4e176 Lib/sysconfig.py --- a/Lib/sysconfig.py Wed Dec 30 21:41:53 2015 +0200 +++ b/Lib/sysconfig.py Fri Jan 01 09:35:33 2016 +0200 @@ -86,8 +86,8 @@ from os.path import pardir, realpath # FIXME don't rely on sys.version here, its format is an implementation detail # of CPython, use sys.version_info or sys.hexversion _PY_VERSION = sys.version.split()[0] -_PY_VERSION_SHORT = sys.version[:3] -_PY_VERSION_SHORT_NO_DOT = _PY_VERSION[0] + _PY_VERSION[2] +_PY_VERSION_SHORT = '%d.%d' % sys.version_info[:2] +_PY_VERSION_SHORT_NO_DOT = '%d%d' % sys.version_info[:2] _PREFIX = os.path.normpath(sys.prefix) _BASE_PREFIX = os.path.normpath(sys.base_prefix) _EXEC_PREFIX = os.path.normpath(sys.exec_prefix) @@ -381,7 +381,7 @@ def _generate_posix_vars(): module.build_time_vars = vars sys.modules[name] = module - pybuilddir = 'build/lib.%s-%s' % (get_platform(), sys.version[:3]) + pybuilddir = 'build/lib.%s-%d.%d' % ((get_platform(),) + sys.version_info[:2]) if hasattr(sys, "gettotalrefcount"): pybuilddir += '-pydebug' os.makedirs(pybuilddir, exist_ok=True) @@ -513,7 +513,7 @@ def get_config_vars(*args): _CONFIG_VARS['exec_prefix'] = _EXEC_PREFIX _CONFIG_VARS['py_version'] = _PY_VERSION _CONFIG_VARS['py_version_short'] = _PY_VERSION_SHORT - _CONFIG_VARS['py_version_nodot'] = _PY_VERSION[0] + _PY_VERSION[2] + _CONFIG_VARS['py_version_nodot'] = _PY_VERSION_SHORT_NO_DOT _CONFIG_VARS['installed_base'] = _BASE_PREFIX _CONFIG_VARS['base'] = _PREFIX _CONFIG_VARS['installed_platbase'] = _BASE_EXEC_PREFIX diff -r 1ab7bcd4e176 Lib/test/test_importlib/test_windows.py --- a/Lib/test/test_importlib/test_windows.py Wed Dec 30 21:41:53 2015 +0200 +++ b/Lib/test/test_importlib/test_windows.py Fri Jan 01 09:35:33 2016 +0200 @@ -40,7 +40,7 @@ def setup_module(machinery, name, path=N else: root = machinery.WindowsRegistryFinder.REGISTRY_KEY key = root.format(fullname=name, - sys_version=sys.version[:3]) + sys_version='%d.%d' % sys.version_info[:2]) try: with temp_module(name, "a = 1") as location: subkey = CreateKey(HKEY_CURRENT_USER, key) diff -r 1ab7bcd4e176 Lib/test/test_site.py --- a/Lib/test/test_site.py Wed Dec 30 21:41:53 2015 +0200 +++ b/Lib/test/test_site.py Fri Jan 01 09:35:33 2016 +0200 @@ -238,13 +238,14 @@ class HelperFunctionsTests(unittest.Test self.assertEqual(len(dirs), 2) wanted = os.path.join('/Library', sysconfig.get_config_var("PYTHONFRAMEWORK"), - sys.version[:3], + '%d.%d' % sys.version_info[:2], 'site-packages') self.assertEqual(dirs[1], wanted) elif os.sep == '/': # OS X non-framwework builds, Linux, FreeBSD, etc self.assertEqual(len(dirs), 1) - wanted = os.path.join('xoxo', 'lib', 'python' + sys.version[:3], + wanted = os.path.join('xoxo', 'lib', + 'python%d.%d' % sys.version_info[:2], 'site-packages') self.assertEqual(dirs[0], wanted) else: diff -r 1ab7bcd4e176 Lib/test/test_venv.py --- a/Lib/test/test_venv.py Wed Dec 30 21:41:53 2015 +0200 +++ b/Lib/test/test_venv.py Fri Jan 01 09:35:33 2016 +0200 @@ -46,7 +46,7 @@ class BaseTest(unittest.TestCase): self.include = 'Include' else: self.bindir = 'bin' - self.lib = ('lib', 'python%s' % sys.version[:3]) + self.lib = ('lib', 'python%d.%d' % sys.version_info[:2]) self.include = 'include' if sys.platform == 'darwin' and '__PYVENV_LAUNCHER__' in os.environ: executable = os.environ['__PYVENV_LAUNCHER__'] diff -r 1ab7bcd4e176 Lib/trace.py --- a/Lib/trace.py Wed Dec 30 21:41:53 2015 +0200 +++ b/Lib/trace.py Fri Jan 01 09:35:33 2016 +0200 @@ -750,10 +750,10 @@ def main(argv=None): s = s.replace("$prefix", os.path.join(sys.base_prefix, "lib", - "python" + sys.version[:3])) + "python%d.%d" % sys.version_info[:2])) s = s.replace("$exec_prefix", os.path.join(sys.base_exec_prefix, "lib", - "python" + sys.version[:3])) + "python%d.%d" % sys.version_info[:2])) s = os.path.normpath(s) ignore_dirs.append(s) continue diff -r 1ab7bcd4e176 Lib/urllib/request.py --- a/Lib/urllib/request.py Wed Dec 30 21:41:53 2015 +0200 +++ b/Lib/urllib/request.py Fri Jan 01 09:35:33 2016 +0200 @@ -133,7 +133,7 @@ else: ] # used in User-Agent header sent -__version__ = sys.version[:3] +__version__ = '%d.%d' % sys.version_info[:2] _opener = None def urlopen(url, data=None, timeout=socket._GLOBAL_DEFAULT_TIMEOUT, diff -r 1ab7bcd4e176 Lib/xmlrpc/client.py --- a/Lib/xmlrpc/client.py Wed Dec 30 21:41:53 2015 +0200 +++ b/Lib/xmlrpc/client.py Fri Jan 01 09:35:33 2016 +0200 @@ -151,7 +151,7 @@ def escape(s): return s.replace(">", ">",) # used in User-Agent header sent -__version__ = sys.version[:3] +__version__ = '%d.%d' % sys.version_info[:2] # xmlrpc integer limits MAXINT = 2**31-1 diff -r 1ab7bcd4e176 Tools/freeze/freeze.py --- a/Tools/freeze/freeze.py Wed Dec 30 21:41:53 2015 +0200 +++ b/Tools/freeze/freeze.py Fri Jan 01 09:35:33 2016 +0200 @@ -218,7 +218,7 @@ def main(): ishome = os.path.exists(os.path.join(prefix, 'Python', 'ceval.c')) # locations derived from options - version = sys.version[:3] + version = '%d.%d' % sys.version_info[:2] flagged_version = version + sys.abiflags if win: extensions_c = 'frozen_extensions.c' diff -r 1ab7bcd4e176 Tools/scripts/nm2def.py --- a/Tools/scripts/nm2def.py Wed Dec 30 21:41:53 2015 +0200 +++ b/Tools/scripts/nm2def.py Fri Jan 01 09:35:33 2016 +0200 @@ -36,8 +36,8 @@ option to produce this format (since it """ import os, sys -PYTHONLIB = 'libpython'+sys.version[:3]+'.a' -PC_PYTHONLIB = 'Python'+sys.version[0]+sys.version[2]+'.dll' +PYTHONLIB = 'libpython%d.%d.a' % sys.version_info[:2] +PC_PYTHONLIB = 'Python%d%d.dll' % sys.version_info[:2] NM = 'nm -p -g %s' # For Linux, use "nm -g %s" def symbols(lib=PYTHONLIB,types=('T','C','D')): diff -r 1ab7bcd4e176 setup.py --- a/setup.py Wed Dec 30 21:41:53 2015 +0200 +++ b/setup.py Fri Jan 01 09:35:33 2016 +0200 @@ -2222,7 +2222,7 @@ def main(): setup(# PyPI Metadata (PEP 301) name = "Python", version = sys.version.split()[0], - url = "http://www.python.org/%s" % sys.version[:3], + url = "http://www.python.org/%d.%d" % sys.version_info[:2], maintainer = "Guido van Rossum and the Python community", maintainer_email = "python-dev@python.org", description = "A high-level object-oriented programming language",