Ah, understood regarding gdb-python3.

sagemath uses cysignals-CSI from the cysignals-tools package to print out a 
more detailed backtrace containing native, cython and python code, when tests 

cysignals-CSI starts gdb and writes the contents of cysignals-CSI-helper.py [1] 
into gdb. That script does things like "from Cython.Debugger import libpython, 
libcython". If gdb (instead of gdb-python2) is used then this fails with an 
error like:

Traceback (most recent call last):
  File "<string>", line 26, in <module>
ModuleNotFoundError: No module named 'Cython'
Error while executing Python code.

because currently we only install cython for python2 when building sagemath. 
So, gdb's libpython3 can't find the Cython module.

After replacing gdb with gdb-python2 I get a nice Cython backtrace instead.


[1] The Debian package installs this file into 
/usr/lib/python3/dist-packages/cysignals_gdb/cysignals-CSI-helper.py but that 
is a Debian-specific innovation by the package maintainer that is slightly 
misleading; the file is just meant to be read into gdb rather than imported in 
a python program.

Matthias Klose:
> On 12.02.2018 15:41, Ximin Luo wrote:
>> Understood, but the entirety of sagemath is python2 at the moment and 
>> doesn't support python3 (upstream is working on it).
>> What's the timeframe for removal of gdb-python2 and will there be a 
>> gdb-python3 alternative?
> gdb is built using python3.  So maybe there is a misunderstanding, but how 
> does
> sagemath use python for debugging? Does it add it's own pretty printers so 
> that
> it needs python2? How is the gdb usage related to Python2?

GPG: ed25519/56034877E1F87C35
GPG: rsa4096/1318EFAC5FBBDBCE

Reply via email to