Proposal: Drop GDB support for Python versions < 2.6

John Baldwin jhb@FreeBSD.org
Thu Feb 21 18:52:00 GMT 2019


On 2/21/19 10:37 AM, André Pönitz wrote:
> On Wed, Feb 20, 2019 at 11:39:15PM -0700, Kevin Buettner wrote:
>> On Thu, 21 Feb 2019 00:28:48 +0100
>> André Pönitz <apoenitz@t-online.de> wrote:
>>
>>> On Wed, Feb 20, 2019 at 03:11:45PM -0700, Kevin Buettner wrote:
>>>> On Wed, 20 Feb 2019 21:44:39 +0000
>>>> Jan Vrany <jan.vrany@fit.cvut.cz> wrote:
>>>>   
>>>>> Actually, I'd even be fine with more radical move, dropping support 
>>>>> for 2.x altogether. Python 2.7 support will end in less a year 
>>>>> from now anyway.   
>>>>
>>>> I'm not ready to drop support for all of 2.X.  
>>>
>>> Out of curiosity: Why?
>>>
>>> I.e. are there realistic scenarios where people actively use GDB's Python
>>> interface (in this context here I am tempted to call it a fairly "recent"
>>> addition to GDB, the first commit seems to be dated Aug 6, 2008), but are
>>> not able to use it with Python 3.x (3.0 released on Dec 3, also 2008)?
>>
>> I think so.  See Eli's reply in this thread.
> 
> I saw it after I wrote my mail. 
>  
>> When I build GDB on Fedora, I get a gdb enabled for python 2.7 unless
>> I take measures (via --with-python=/usr/bin/python3) to use python 3.X
>> instead.
>>
>> I just checked three recent linux distro releases: Mint 19.1, Debian 9.8, and
>> Fedora 29.  For each of them, running "python --version" shows that they're
>> all Python 2.7.X.  Python 3 is often available, but you have to use the
>> python3 command to use it.
>>
>> Checking my CentOS 7.6 box, I find that Python 2.7.5 is installed, but
>> Python 3 is not.  However, I see that I could install some version of
>> Python 3 if I needed it.  (I'm not using this machine for development.)
>>
>> I think we can drop Python 2.7 (and lower) sometime after the major
>> Linux distributions start defaulting to python 3.X for the "python"
>> command.
> 
> I am not sure that the name of the python command is a good indicator
> for the timimg of the dropping support for Python 2.x:
> 
> First, the version of Python used for 'python' is technical, and in a few
> cases also practically to the version of Python GDB uses. E.g. on some Ubuntu
> machine here I see something like:
> 
>     ~ > gdb -batch -ex 'import sys' -ex 'py print(sys.version)'
>     3.6.7 (default, Oct 22 2018, 11:32:17)
> 
>     ~ > python --version
>     2.7.15rc1
> 
>     ~ > python3 --version
>     3.6.7
> 
> Second, there might be reasons for a distribution to never change the name
> of the python command, i.e. always keep it at e.g. 'python3', with no
> 'python' provided even after the distribution drops Python 2.x, so waiting
> for a 'python --version' to produe 3.x might as well mean 'never'.

On the other hand, there is a notion of "what is the default python version
most packages use".  On FreeBSD this is still python 2.7 as well for many
things, though you can request python3 (e.g. for gdb there are 'gdb' and
'gdb-py3' packages where the first (default) one uses 2.7).  I agree that
'python' might stay 2.7 forever due to legacy compat reasons, but I think
the metric of when distributions start preferrring python3 by default for
various other packages isn't a bad metric.

-- 
John Baldwin

                                                                            



More information about the Gdb mailing list