summaryrefslogtreecommitdiff
path: root/Lib/platform.py
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2010-01-25 03:31:13 +0000
committerBenjamin Peterson <benjamin@python.org>2010-01-25 03:31:13 +0000
commita43f34cc2a7a55cea794ecb9bda2eea5c685d1f3 (patch)
treeb9d565fb57073f0ce30bbeceab1120dee77f09c4 /Lib/platform.py
parentaab24019777c5aee222b67e785a88c3e2909c5de (diff)
downloadcpython-git-a43f34cc2a7a55cea794ecb9bda2eea5c685d1f3.tar.gz
fix an UnboundLocalError when the release file is empty #7773
Diffstat (limited to 'Lib/platform.py')
-rwxr-xr-xLib/platform.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/Lib/platform.py b/Lib/platform.py
index 5df1e2305e..829d5f0fd5 100755
--- a/Lib/platform.py
+++ b/Lib/platform.py
@@ -263,6 +263,12 @@ _supported_dists = (
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:
@@ -280,8 +286,6 @@ def _parse_release_file(firstline):
version = l[0]
if len(l) > 1:
id = l[1]
- else:
- id = ''
return '', version, id
def linux_distribution(distname='', version='', id='',