Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
a43f34cc
Commit
a43f34cc
authored
Jan 25, 2010
by
Benjamin Peterson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix an UnboundLocalError when the release file is empty #7773
parent
aab24019
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
11 additions
and
2 deletions
+11
-2
Lib/platform.py
Lib/platform.py
+6
-2
Lib/test/test_platform.py
Lib/test/test_platform.py
+1
-0
Misc/ACKS
Misc/ACKS
+1
-0
Misc/NEWS
Misc/NEWS
+3
-0
No files found.
Lib/platform.py
View file @
a43f34cc
...
@@ -263,6 +263,12 @@ _supported_dists = (
...
@@ -263,6 +263,12 @@ _supported_dists = (
def _parse_release_file(firstline):
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
# Parse the first line
m = _lsb_release_version.match(firstline)
m = _lsb_release_version.match(firstline)
if m is not None:
if m is not None:
...
@@ -280,8 +286,6 @@ def _parse_release_file(firstline):
...
@@ -280,8 +286,6 @@ def _parse_release_file(firstline):
version = l[0]
version = l[0]
if len(l) > 1:
if len(l) > 1:
id = l[1]
id = l[1]
else:
id = ''
return '', version, id
return '', version, id
def linux_distribution(distname='', version='', id='',
def linux_distribution(distname='', version='', id='',
...
...
Lib/test/test_platform.py
View file @
a43f34cc
...
@@ -198,6 +198,7 @@ class PlatformTest(unittest.TestCase):
...
@@ -198,6 +198,7 @@ class PlatformTest(unittest.TestCase):
(
'Red Hat Enterprise Linux release 4 (Nahant)'
,
(
'Red Hat Enterprise Linux'
,
'4'
,
'Nahant'
)),
(
'Red Hat Enterprise Linux release 4 (Nahant)'
,
(
'Red Hat Enterprise Linux'
,
'4'
,
'Nahant'
)),
(
'CentOS release 4'
,
(
'CentOS'
,
'4'
,
None
)),
(
'CentOS release 4'
,
(
'CentOS'
,
'4'
,
None
)),
(
'Rocks release 4.2.1 (Cydonia)'
,
(
'Rocks'
,
'4.2.1'
,
'Cydonia'
)),
(
'Rocks release 4.2.1 (Cydonia)'
,
(
'Rocks'
,
'4.2.1'
,
'Cydonia'
)),
(
''
,
(
''
,
''
,
''
)),
# If there's nothing there.
):
):
self
.
assertEqual
(
platform
.
_parse_release_file
(
input
),
output
)
self
.
assertEqual
(
platform
.
_parse_release_file
(
input
),
output
)
...
...
Misc/ACKS
View file @
a43f34cc
...
@@ -357,6 +357,7 @@ Jeremy Hylton
...
@@ -357,6 +357,7 @@ Jeremy Hylton
Gerhard Häring
Gerhard Häring
Mihai Ibanescu
Mihai Ibanescu
Lars Immisch
Lars Immisch
Meador Inge
Tony Ingraldi
Tony Ingraldi
John Interrante
John Interrante
Bob Ippolito
Bob Ippolito
...
...
Misc/NEWS
View file @
a43f34cc
...
@@ -42,6 +42,9 @@ Core and Builtins
...
@@ -42,6 +42,9 @@ Core and Builtins
Library
Library
-------
-------
- Issue #7773: Fix an UnboundLocalError in platform.linux_distribution() when
the release file is empty.
- Issue #7748: Since unicode values are supported for some metadata options
- Issue #7748: Since unicode values are supported for some metadata options
in Distutils, the DistributionMetadata get_* methods will now return an utf-8
in Distutils, the DistributionMetadata get_* methods will now return an utf-8
encoded string for them. This ensure that the upload and register commands
encoded string for them. This ensure that the upload and register commands
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment