[Python-checkins] r77737 - in python/branches/py3k: Lib/platform.py Lib/test/test_platform.py Misc/ACKS Misc/NEWS
benjamin.peterson
python-checkins at python.org
Mon Jan 25 04:37:43 CET 2010
Author: benjamin.peterson
Date: Mon Jan 25 04:37:42 2010
New Revision: 77737
Log:
Merged revisions 77735 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r77735 | benjamin.peterson | 2010-01-24 21:31:13 -0600 (Sun, 24 Jan 2010) | 1 line
fix an UnboundLocalError when the release file is empty #7773
........
Modified:
python/branches/py3k/ (props changed)
python/branches/py3k/Lib/platform.py
python/branches/py3k/Lib/test/test_platform.py
python/branches/py3k/Misc/ACKS
python/branches/py3k/Misc/NEWS
Modified: python/branches/py3k/Lib/platform.py
==============================================================================
--- python/branches/py3k/Lib/platform.py (original)
+++ python/branches/py3k/Lib/platform.py Mon Jan 25 04:37:42 2010
@@ -261,6 +261,12 @@
def _parse_release_file(firstline):
+ # Default to empty 'version' and 'id' strings. Both defaults are used
+ # when 'firstline' is empty. 'id' defaults to empty when an id can not
+ # be deduced.
+ version = ''
+ id = ''
+
# Parse the first line
m = _lsb_release_version.match(firstline)
if m is not None:
@@ -278,8 +284,6 @@
version = l[0]
if len(l) > 1:
id = l[1]
- else:
- id = ''
return '', version, id
def linux_distribution(distname='', version='', id='',
Modified: python/branches/py3k/Lib/test/test_platform.py
==============================================================================
--- python/branches/py3k/Lib/test/test_platform.py (original)
+++ python/branches/py3k/Lib/test/test_platform.py Mon Jan 25 04:37:42 2010
@@ -191,6 +191,7 @@
('Red Hat Enterprise Linux release 4 (Nahant)', ('Red Hat Enterprise Linux', '4', 'Nahant')),
('CentOS release 4', ('CentOS', '4', None)),
('Rocks release 4.2.1 (Cydonia)', ('Rocks', '4.2.1', 'Cydonia')),
+ ('', ('', '', '')), # If there's nothing there.
):
self.assertEqual(platform._parse_release_file(input), output)
Modified: python/branches/py3k/Misc/ACKS
==============================================================================
--- python/branches/py3k/Misc/ACKS (original)
+++ python/branches/py3k/Misc/ACKS Mon Jan 25 04:37:42 2010
@@ -357,6 +357,7 @@
Gerhard Häring
Mihai Ibanescu
Lars Immisch
+Meador Inge
Tony Ingraldi
John Interrante
Bob Ippolito
Modified: python/branches/py3k/Misc/NEWS
==============================================================================
--- python/branches/py3k/Misc/NEWS (original)
+++ python/branches/py3k/Misc/NEWS Mon Jan 25 04:37:42 2010
@@ -229,6 +229,9 @@
Library
-------
+- Issue #7773: Fix an UnboundLocalError in platform.linux_distribution() when
+ the release file is empty.
+
- Issue #7561: Fix crashes when using bytearray objects with the posix
module.
More information about the Python-checkins
mailing list