summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2011-03-06 09:13:00 (GMT)
committerGeorg Brandl <georg@python.org>2011-03-06 09:13:00 (GMT)
commit13039c87f14aeed325bcb5fadd202922a614957b (patch)
treef78ce4e5acffdb796e9c1803a7b2127100f5fd4f /Lib
parent80d3610bc36e484fbe7b7ccce366a73314505a16 (diff)
parent8256242b30005b8a1b52e79149558ad36f1307d6 (diff)
downloadcpython-13039c87f14aeed325bcb5fadd202922a614957b.zip
cpython-13039c87f14aeed325bcb5fadd202922a614957b.tar.gz
cpython-13039c87f14aeed325bcb5fadd202922a614957b.tar.bz2
Merge build identification to 3.2 branch.
Diffstat (limited to 'Lib')
-rwxr-xr-xLib/platform.py4
-rw-r--r--Lib/test/test_platform.py6
2 files changed, 8 insertions, 2 deletions
diff --git a/Lib/platform.py b/Lib/platform.py
index b9bc303..de81b63 100755
--- a/Lib/platform.py
+++ b/Lib/platform.py
@@ -1392,7 +1392,9 @@ def _sys_version(sys_version=None):
name = 'CPython'
builddate = builddate + ' ' + buildtime
- if hasattr(sys, 'subversion'):
+ if hasattr(sys, '_mercurial'):
+ _, branch, revision = sys._mercurial
+ elif hasattr(sys, 'subversion'):
# sys.subversion was added in Python 2.5
_, branch, revision = sys.subversion
else:
diff --git a/Lib/test/test_platform.py b/Lib/test/test_platform.py
index 7dd7eef..ec134a1 100644
--- a/Lib/test/test_platform.py
+++ b/Lib/test/test_platform.py
@@ -57,11 +57,13 @@ class PlatformTest(unittest.TestCase):
def setUp(self):
self.save_version = sys.version
self.save_subversion = sys.subversion
+ self.save_mercurial = sys._mercurial
self.save_platform = sys.platform
def tearDown(self):
sys.version = self.save_version
sys.subversion = self.save_subversion
+ sys._mercurial = self.save_mercurial
sys.platform = self.save_platform
def test_sys_version(self):
@@ -109,10 +111,12 @@ class PlatformTest(unittest.TestCase):
sys_versions.items():
sys.version = version_tag
if subversion is None:
+ if hasattr(sys, "_mercurial"):
+ del sys._mercurial
if hasattr(sys, "subversion"):
del sys.subversion
else:
- sys.subversion = subversion
+ sys._mercurial = subversion
if sys_platform is not None:
sys.platform = sys_platform
self.assertEqual(platform.python_implementation(), info[0])