Title: Missing code in linux_distribution python 2.7.11
Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 2.7
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: Rasmus Rynning Rasmussen, kdwyer, martin.panter, terry.reedy
Priority: normal Keywords:

Created on 2016-01-27 17:45 by Rasmus Rynning Rasmussen, last changed 2016-01-30 09:53 by berker.peksag. This issue is now closed.

Messages (4)
msg259037 - (view) Author: Rasmus Rynning Rasmussen (Rasmus Rynning Rasmussen) Date: 2016-01-27 17:45
During the transition from python 2.7.10 to 2.7.11 some code seems to have been lost. platform.linux_distribution() is not able to recognise Debian based distributions in python 2.7.11.

The following code was present in, python 2.7.10, but seems to be missing in 2.7.11

# check for the LSB /etc/lsb-release file first, needed so
# that the distribution doesn't get identified as Debian.
        with open("/etc/lsb-release", "rU") as etclsbrel:
            for line in etclsbrel:
                m =
                if m:
                    _u_distname =
                m =
                if m:
                    _u_version =
                m =
                if m:
                    _u_id =
            if _u_distname and _u_version:
                return (_u_distname, _u_version, _u_id)
    except (EnvironmentError, UnboundLocalError):
msg259128 - (view) Author: Kevin Dwyer (kdwyer) Date: 2016-01-28 13:31
The quoted code doesn't exist in 2.7.10 (

It looks like it's from a patch applied by Debian themselves: see
msg259159 - (view) Author: Martin Panter (martin.panter) * (Python committer) Date: 2016-01-28 21:19
I think Kevin is right. Debian often carries its own downstream patches. In this case, the patch was proposed in Issue 9514, which is closed as “won’t fix”. In Python 3, linux_distribution() is apparently deprecated (Issue 1322).
msg259232 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2016-01-30 02:27
From the last two comments, it looks like this should be closed as 'not a bug'.
Date User Action Args
2016-01-30 09:53:28berker.peksagsetstatus: open -> closed
resolution: not a bug
stage: resolved
2016-01-30 02:27:45terry.reedysetnosy: + terry.reedy
messages: + msg259232
2016-01-28 21:19:12martin.pantersetnosy: + martin.panter
messages: + msg259159
components: + Library (Lib), - Build
2016-01-28 18:45:36kdwyersettype: performance -> behavior
2016-01-28 13:31:19kdwyersetnosy: + kdwyer
messages: + msg259128
2016-01-27 17:45:27Rasmus Rynning Rasmussencreate