mirror of
https://github.com/python/cpython.git
synced 2025-07-28 13:44:43 +00:00
fix an UnboundLocalError when the release file is empty #7773
This commit is contained in:
parent
aab2401977
commit
a43f34cc2a
4 changed files with 11 additions and 2 deletions
|
@ -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='',
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue